pub struct CostClient { /* private fields */ }Expand description
Calls CostService.
Usage and cost: what a project, an organization or a billing account used in a period, and what it costs, as read-only reports.
Usage is metered per resource and priced when it is recorded, at the price list’s rate then, so a later price change never changes a past cost. A running resource’s usage is recorded at least hourly; the last hour can still be missing from a report.
Implementations§
Source§impl CostClient
impl CostClient
Sourcepub fn new(client: &Client) -> Self
pub fn new(client: &Client) -> Self
Returns a client of CostService that sends its calls through client.
Sourcepub fn service(&self) -> &Service
pub fn service(&self) -> &Service
The endpoint the client sends its calls to, which also serves the operations its methods answer with.
Sourcepub async fn query_project_cost(
&self,
request: QueryProjectCostRequest,
) -> Result<CostReport, Error>
pub async fn query_project_cost( &self, request: QueryProjectCostRequest, ) -> Result<CostReport, Error>
Returns a project’s cost in a period, by service and product, in hourly
or daily buckets. Needs admin.usage.list on the organization.
Sourcepub async fn query_organization_cost(
&self,
request: QueryOrganizationCostRequest,
) -> Result<OrganizationCostReport, Error>
pub async fn query_organization_cost( &self, request: QueryOrganizationCostRequest, ) -> Result<OrganizationCostReport, Error>
Returns an organization’s cost in a period: every project’s together,
by service and product, and each project’s on its own. Needs
admin.usage.list on the organization, which reads every project’s
cost in it.
Sourcepub async fn query_billing_account_cost(
&self,
request: QueryBillingAccountCostRequest,
) -> Result<CostReport, Error>
pub async fn query_billing_account_cost( &self, request: QueryBillingAccountCostRequest, ) -> Result<CostReport, Error>
Returns what was charged to a billing account in a period, by service
and product. A project’s cost is charged to the account it was linked
to when the usage was recorded, so moving a project moves only its
later cost. Its spend limit compares the calendar month’s total with
limit. Needs admin.spend_limit.get on the organization.
Sourcepub async fn query_project_usage(
&self,
request: QueryProjectUsageRequest,
) -> Result<QueryProjectUsageResponse, Error>
pub async fn query_project_usage( &self, request: QueryProjectUsageRequest, ) -> Result<QueryProjectUsageResponse, Error>
Lists a project’s metered usage records that overlap a period, the
input its cost is priced from, oldest first. Needs admin.usage.list
on the organization.
Sourcepub fn all_usage_records(
&self,
request: QueryProjectUsageRequest,
) -> Pages<UsageRecord>
pub fn all_usage_records( &self, request: QueryProjectUsageRequest, ) -> Pages<UsageRecord>
Returns everything query_project_usage lists from request’s page on, fetching the next page as the stream reaches it. A page that fails ends the stream with its error.