Copyright | (c) 2013-2021 Brendan Hay |
---|---|
License | Mozilla Public License, v. 2.0. |
Maintainer | Brendan Hay <brendan.g.hay+amazonka@gmail.com> |
Stability | auto-generated |
Portability | non-portable (GHC extensions) |
Safe Haskell | None |
Retrieves cost and usage metrics with resources for your account. You
can specify which cost and usage-related metric, such as BlendedCosts
or UsageQuantity
, that you want the request to return. You can also
filter and group your data by various dimensions, such as SERVICE
or
AZ
, in a specific time range. For a complete list of valid dimensions,
see the
GetDimensionValues
operation. Management account in an organization in Organizations have
access to all member accounts. This API is currently available for the
Amazon Elastic Compute Cloud – Compute service only.
This is an opt-in only feature. You can enable this feature from the Cost Explorer Settings page. For information on how to access the Settings page, see Controlling Access for Cost Explorer in the Billing and Cost Management User Guide.
Synopsis
- data GetCostAndUsageWithResources = GetCostAndUsageWithResources' {}
- newGetCostAndUsageWithResources :: DateInterval -> Granularity -> Expression -> GetCostAndUsageWithResources
- getCostAndUsageWithResources_groupBy :: Lens' GetCostAndUsageWithResources (Maybe [GroupDefinition])
- getCostAndUsageWithResources_nextPageToken :: Lens' GetCostAndUsageWithResources (Maybe Text)
- getCostAndUsageWithResources_metrics :: Lens' GetCostAndUsageWithResources (Maybe [Text])
- getCostAndUsageWithResources_timePeriod :: Lens' GetCostAndUsageWithResources DateInterval
- getCostAndUsageWithResources_granularity :: Lens' GetCostAndUsageWithResources Granularity
- getCostAndUsageWithResources_filter :: Lens' GetCostAndUsageWithResources Expression
- data GetCostAndUsageWithResourcesResponse = GetCostAndUsageWithResourcesResponse' {}
- newGetCostAndUsageWithResourcesResponse :: Int -> GetCostAndUsageWithResourcesResponse
- getCostAndUsageWithResourcesResponse_resultsByTime :: Lens' GetCostAndUsageWithResourcesResponse (Maybe [ResultByTime])
- getCostAndUsageWithResourcesResponse_nextPageToken :: Lens' GetCostAndUsageWithResourcesResponse (Maybe Text)
- getCostAndUsageWithResourcesResponse_dimensionValueAttributes :: Lens' GetCostAndUsageWithResourcesResponse (Maybe [DimensionValuesWithAttributes])
- getCostAndUsageWithResourcesResponse_groupDefinitions :: Lens' GetCostAndUsageWithResourcesResponse (Maybe [GroupDefinition])
- getCostAndUsageWithResourcesResponse_httpStatus :: Lens' GetCostAndUsageWithResourcesResponse Int
Creating a Request
data GetCostAndUsageWithResources Source #
See: newGetCostAndUsageWithResources
smart constructor.
GetCostAndUsageWithResources' | |
|
Instances
newGetCostAndUsageWithResources Source #
Create a value of GetCostAndUsageWithResources
with all optional fields omitted.
Use generic-lens or optics to modify other optional fields.
The following record fields are available, with the corresponding lenses provided for backwards compatibility:
$sel:groupBy:GetCostAndUsageWithResources'
, getCostAndUsageWithResources_groupBy
- You can group Amazon Web Services costs using up to two different
groups: DIMENSION
, TAG
, COST_CATEGORY
.
$sel:nextPageToken:GetCostAndUsageWithResources'
, getCostAndUsageWithResources_nextPageToken
- The token to retrieve the next set of results. Amazon Web Services
provides the token when the response from a previous call has more
results than the maximum page size.
$sel:metrics:GetCostAndUsageWithResources'
, getCostAndUsageWithResources_metrics
- Which metrics are returned in the query. For more information about
blended and unblended rates, see
Why does the "blended" annotation appear on some line items in my bill?.
Valid values are AmortizedCost
, BlendedCost
, NetAmortizedCost
,
NetUnblendedCost
, NormalizedUsageAmount
, UnblendedCost
, and
UsageQuantity
.
If you return the UsageQuantity
metric, the service aggregates all
usage numbers without taking the units into account. For example, if you
aggregate usageQuantity
across all of Amazon EC2, the results aren't
meaningful because Amazon EC2 compute hours and data transfer are
measured in different units (for example, hours vs. GB). To get more
meaningful UsageQuantity
metrics, filter by UsageType
or
UsageTypeGroups
.
Metrics
is required for GetCostAndUsageWithResources
requests.
$sel:timePeriod:GetCostAndUsageWithResources'
, getCostAndUsageWithResources_timePeriod
- Sets the start and end dates for retrieving Amazon Web Services costs.
The range must be within the last 14 days (the start date cannot be
earlier than 14 days ago). The start date is inclusive, but the end date
is exclusive. For example, if start
is 2017-01-01
and end
is
2017-05-01
, then the cost and usage data is retrieved from
2017-01-01
up to and including 2017-04-30
but not including
2017-05-01
.
$sel:granularity:GetCostAndUsageWithResources'
, getCostAndUsageWithResources_granularity
- Sets the Amazon Web Services cost granularity to MONTHLY
, DAILY
, or
HOURLY
. If Granularity
isn't set, the response object doesn't
include the Granularity
, MONTHLY
, DAILY
, or HOURLY
.
$sel:filter':GetCostAndUsageWithResources'
, getCostAndUsageWithResources_filter
- Filters Amazon Web Services costs by different dimensions. For example,
you can specify SERVICE
and LINKED_ACCOUNT
and get the costs that
are associated with that account's usage of that service. You can nest
Expression
objects to define any combination of dimension filters. For
more information, see
Expression.
The GetCostAndUsageWithResources
operation requires that you either
group by or filter by a ResourceId
. It requires the
Expression
"SERVICE = Amazon Elastic Compute Cloud - Compute"
in the filter.
Request Lenses
getCostAndUsageWithResources_groupBy :: Lens' GetCostAndUsageWithResources (Maybe [GroupDefinition]) Source #
You can group Amazon Web Services costs using up to two different
groups: DIMENSION
, TAG
, COST_CATEGORY
.
getCostAndUsageWithResources_nextPageToken :: Lens' GetCostAndUsageWithResources (Maybe Text) Source #
The token to retrieve the next set of results. Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size.
getCostAndUsageWithResources_metrics :: Lens' GetCostAndUsageWithResources (Maybe [Text]) Source #
Which metrics are returned in the query. For more information about blended and unblended rates, see Why does the "blended" annotation appear on some line items in my bill?.
Valid values are AmortizedCost
, BlendedCost
, NetAmortizedCost
,
NetUnblendedCost
, NormalizedUsageAmount
, UnblendedCost
, and
UsageQuantity
.
If you return the UsageQuantity
metric, the service aggregates all
usage numbers without taking the units into account. For example, if you
aggregate usageQuantity
across all of Amazon EC2, the results aren't
meaningful because Amazon EC2 compute hours and data transfer are
measured in different units (for example, hours vs. GB). To get more
meaningful UsageQuantity
metrics, filter by UsageType
or
UsageTypeGroups
.
Metrics
is required for GetCostAndUsageWithResources
requests.
getCostAndUsageWithResources_timePeriod :: Lens' GetCostAndUsageWithResources DateInterval Source #
Sets the start and end dates for retrieving Amazon Web Services costs.
The range must be within the last 14 days (the start date cannot be
earlier than 14 days ago). The start date is inclusive, but the end date
is exclusive. For example, if start
is 2017-01-01
and end
is
2017-05-01
, then the cost and usage data is retrieved from
2017-01-01
up to and including 2017-04-30
but not including
2017-05-01
.
getCostAndUsageWithResources_granularity :: Lens' GetCostAndUsageWithResources Granularity Source #
Sets the Amazon Web Services cost granularity to MONTHLY
, DAILY
, or
HOURLY
. If Granularity
isn't set, the response object doesn't
include the Granularity
, MONTHLY
, DAILY
, or HOURLY
.
getCostAndUsageWithResources_filter :: Lens' GetCostAndUsageWithResources Expression Source #
Filters Amazon Web Services costs by different dimensions. For example,
you can specify SERVICE
and LINKED_ACCOUNT
and get the costs that
are associated with that account's usage of that service. You can nest
Expression
objects to define any combination of dimension filters. For
more information, see
Expression.
The GetCostAndUsageWithResources
operation requires that you either
group by or filter by a ResourceId
. It requires the
Expression
"SERVICE = Amazon Elastic Compute Cloud - Compute"
in the filter.
Destructuring the Response
data GetCostAndUsageWithResourcesResponse Source #
See: newGetCostAndUsageWithResourcesResponse
smart constructor.
GetCostAndUsageWithResourcesResponse' | |
|
Instances
newGetCostAndUsageWithResourcesResponse Source #
Create a value of GetCostAndUsageWithResourcesResponse
with all optional fields omitted.
Use generic-lens or optics to modify other optional fields.
The following record fields are available, with the corresponding lenses provided for backwards compatibility:
$sel:resultsByTime:GetCostAndUsageWithResourcesResponse'
, getCostAndUsageWithResourcesResponse_resultsByTime
- The time period that is covered by the results in the response.
$sel:nextPageToken:GetCostAndUsageWithResources'
, getCostAndUsageWithResourcesResponse_nextPageToken
- The token for the next set of retrievable results. Amazon Web Services
provides the token when the response from a previous call has more
results than the maximum page size.
$sel:dimensionValueAttributes:GetCostAndUsageWithResourcesResponse'
, getCostAndUsageWithResourcesResponse_dimensionValueAttributes
- The attributes that apply to a specific dimension value. For example, if
the value is a linked account, the attribute is that account name.
$sel:groupDefinitions:GetCostAndUsageWithResourcesResponse'
, getCostAndUsageWithResourcesResponse_groupDefinitions
- The groups that are specified by the Filter
or GroupBy
parameters in
the request.
$sel:httpStatus:GetCostAndUsageWithResourcesResponse'
, getCostAndUsageWithResourcesResponse_httpStatus
- The response's http status code.
Response Lenses
getCostAndUsageWithResourcesResponse_resultsByTime :: Lens' GetCostAndUsageWithResourcesResponse (Maybe [ResultByTime]) Source #
The time period that is covered by the results in the response.
getCostAndUsageWithResourcesResponse_nextPageToken :: Lens' GetCostAndUsageWithResourcesResponse (Maybe Text) Source #
The token for the next set of retrievable results. Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size.
getCostAndUsageWithResourcesResponse_dimensionValueAttributes :: Lens' GetCostAndUsageWithResourcesResponse (Maybe [DimensionValuesWithAttributes]) Source #
The attributes that apply to a specific dimension value. For example, if the value is a linked account, the attribute is that account name.
getCostAndUsageWithResourcesResponse_groupDefinitions :: Lens' GetCostAndUsageWithResourcesResponse (Maybe [GroupDefinition]) Source #
The groups that are specified by the Filter
or GroupBy
parameters in
the request.
getCostAndUsageWithResourcesResponse_httpStatus :: Lens' GetCostAndUsageWithResourcesResponse Int Source #
The response's http status code.