libZSservicesZSamazonka-cost-explorerZSamazonka-cost-explorer
Copyright(c) 2013-2021 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay <brendan.g.hay+amazonka@gmail.com>
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellNone

Amazonka.CostExplorer.GetCostAndUsageWithResources

Description

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

Creating a Request

data GetCostAndUsageWithResources Source #

See: newGetCostAndUsageWithResources smart constructor.

Constructors

GetCostAndUsageWithResources' 

Fields

  • groupBy :: Maybe [GroupDefinition]

    You can group Amazon Web Services costs using up to two different groups: DIMENSION, TAG, COST_CATEGORY.

  • nextPageToken :: Maybe Text

    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.

  • metrics :: Maybe [Text]

    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.

  • timePeriod :: DateInterval

    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.

  • granularity :: 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.

  • filter' :: Expression

    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.

Instances

Instances details
Eq GetCostAndUsageWithResources Source # 
Instance details

Defined in Amazonka.CostExplorer.GetCostAndUsageWithResources

Read GetCostAndUsageWithResources Source # 
Instance details

Defined in Amazonka.CostExplorer.GetCostAndUsageWithResources

Show GetCostAndUsageWithResources Source # 
Instance details

Defined in Amazonka.CostExplorer.GetCostAndUsageWithResources

Generic GetCostAndUsageWithResources Source # 
Instance details

Defined in Amazonka.CostExplorer.GetCostAndUsageWithResources

Associated Types

type Rep GetCostAndUsageWithResources :: Type -> Type #

NFData GetCostAndUsageWithResources Source # 
Instance details

Defined in Amazonka.CostExplorer.GetCostAndUsageWithResources

Hashable GetCostAndUsageWithResources Source # 
Instance details

Defined in Amazonka.CostExplorer.GetCostAndUsageWithResources

ToJSON GetCostAndUsageWithResources Source # 
Instance details

Defined in Amazonka.CostExplorer.GetCostAndUsageWithResources

AWSRequest GetCostAndUsageWithResources Source # 
Instance details

Defined in Amazonka.CostExplorer.GetCostAndUsageWithResources

ToHeaders GetCostAndUsageWithResources Source # 
Instance details

Defined in Amazonka.CostExplorer.GetCostAndUsageWithResources

ToPath GetCostAndUsageWithResources Source # 
Instance details

Defined in Amazonka.CostExplorer.GetCostAndUsageWithResources

ToQuery GetCostAndUsageWithResources Source # 
Instance details

Defined in Amazonka.CostExplorer.GetCostAndUsageWithResources

type Rep GetCostAndUsageWithResources Source # 
Instance details

Defined in Amazonka.CostExplorer.GetCostAndUsageWithResources

type Rep GetCostAndUsageWithResources = D1 ('MetaData "GetCostAndUsageWithResources" "Amazonka.CostExplorer.GetCostAndUsageWithResources" "libZSservicesZSamazonka-cost-explorerZSamazonka-cost-explorer" 'False) (C1 ('MetaCons "GetCostAndUsageWithResources'" 'PrefixI 'True) ((S1 ('MetaSel ('Just "groupBy") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [GroupDefinition])) :*: (S1 ('MetaSel ('Just "nextPageToken") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "metrics") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [Text])))) :*: (S1 ('MetaSel ('Just "timePeriod") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 DateInterval) :*: (S1 ('MetaSel ('Just "granularity") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Granularity) :*: S1 ('MetaSel ('Just "filter'") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Expression)))))
type AWSResponse GetCostAndUsageWithResources Source # 
Instance details

Defined in Amazonka.CostExplorer.GetCostAndUsageWithResources

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 #

Constructors

GetCostAndUsageWithResourcesResponse' 

Fields

Instances

Instances details
Eq GetCostAndUsageWithResourcesResponse Source # 
Instance details

Defined in Amazonka.CostExplorer.GetCostAndUsageWithResources

Read GetCostAndUsageWithResourcesResponse Source # 
Instance details

Defined in Amazonka.CostExplorer.GetCostAndUsageWithResources

Show GetCostAndUsageWithResourcesResponse Source # 
Instance details

Defined in Amazonka.CostExplorer.GetCostAndUsageWithResources

Generic GetCostAndUsageWithResourcesResponse Source # 
Instance details

Defined in Amazonka.CostExplorer.GetCostAndUsageWithResources

NFData GetCostAndUsageWithResourcesResponse Source # 
Instance details

Defined in Amazonka.CostExplorer.GetCostAndUsageWithResources

type Rep GetCostAndUsageWithResourcesResponse Source # 
Instance details

Defined in Amazonka.CostExplorer.GetCostAndUsageWithResources

type Rep GetCostAndUsageWithResourcesResponse = D1 ('MetaData "GetCostAndUsageWithResourcesResponse" "Amazonka.CostExplorer.GetCostAndUsageWithResources" "libZSservicesZSamazonka-cost-explorerZSamazonka-cost-explorer" 'False) (C1 ('MetaCons "GetCostAndUsageWithResourcesResponse'" 'PrefixI 'True) ((S1 ('MetaSel ('Just "resultsByTime") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [ResultByTime])) :*: S1 ('MetaSel ('Just "nextPageToken") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text))) :*: (S1 ('MetaSel ('Just "dimensionValueAttributes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [DimensionValuesWithAttributes])) :*: (S1 ('MetaSel ('Just "groupDefinitions") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [GroupDefinition])) :*: S1 ('MetaSel ('Just "httpStatus") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int)))))

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_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.