Class GetCostAndUsageRequest
- java.lang.Object
-
- software.amazon.awssdk.core.SdkRequest
-
- software.amazon.awssdk.awscore.AwsRequest
-
- software.amazon.awssdk.services.costexplorer.model.CostExplorerRequest
-
- software.amazon.awssdk.services.costexplorer.model.GetCostAndUsageRequest
-
- All Implemented Interfaces:
SdkPojo,ToCopyableBuilder<GetCostAndUsageRequest.Builder,GetCostAndUsageRequest>
@Generated("software.amazon.awssdk:codegen") public final class GetCostAndUsageRequest extends CostExplorerRequest implements ToCopyableBuilder<GetCostAndUsageRequest.Builder,GetCostAndUsageRequest>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceGetCostAndUsageRequest.Builder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static GetCostAndUsageRequest.Builderbuilder()booleanequals(Object obj)booleanequalsBySdkFields(Object obj)Expressionfilter()Filters Amazon Web Services costs by different dimensions.<T> Optional<T>getValueForField(String fieldName, Class<T> clazz)Granularitygranularity()Sets the Amazon Web Services cost granularity toMONTHLYorDAILY, orHOURLY.StringgranularityAsString()Sets the Amazon Web Services cost granularity toMONTHLYorDAILY, orHOURLY.List<GroupDefinition>groupBy()You can group Amazon Web Services costs using up to two different groups, either dimensions, tag keys, cost categories, or any two group by types.booleanhasGroupBy()For responses, this returns true if the service returned a value for the GroupBy property.inthashCode()booleanhasMetrics()For responses, this returns true if the service returned a value for the Metrics property.List<String>metrics()Which metrics are returned in the query.StringnextPageToken()The token to retrieve the next set of results.List<SdkField<?>>sdkFields()static Class<? extends GetCostAndUsageRequest.Builder>serializableBuilderClass()DateIntervaltimePeriod()Sets the start date and end date for retrieving Amazon Web Services costs.GetCostAndUsageRequest.BuildertoBuilder()StringtoString()Returns a string representation of this object.-
Methods inherited from class software.amazon.awssdk.awscore.AwsRequest
overrideConfiguration
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface software.amazon.awssdk.utils.builder.ToCopyableBuilder
copy
-
-
-
-
Method Detail
-
timePeriod
public final DateInterval timePeriod()
Sets the start date and end date for retrieving Amazon Web Services costs. The start date is inclusive, but the end date is exclusive. For example, if
startis2017-01-01andendis2017-05-01, then the cost and usage data is retrieved from2017-01-01up to and including2017-04-30but not including2017-05-01.- Returns:
- Sets the start date and end date for retrieving Amazon Web Services costs. The start date is inclusive,
but the end date is exclusive. For example, if
startis2017-01-01andendis2017-05-01, then the cost and usage data is retrieved from2017-01-01up to and including2017-04-30but not including2017-05-01.
-
granularity
public final Granularity granularity()
Sets the Amazon Web Services cost granularity to
MONTHLYorDAILY, orHOURLY. IfGranularityisn't set, the response object doesn't include theGranularity, eitherMONTHLYorDAILY, orHOURLY.If the service returns an enum value that is not available in the current SDK version,
granularitywill returnGranularity.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available fromgranularityAsString().- Returns:
- Sets the Amazon Web Services cost granularity to
MONTHLYorDAILY, orHOURLY. IfGranularityisn't set, the response object doesn't include theGranularity, eitherMONTHLYorDAILY, orHOURLY. - See Also:
Granularity
-
granularityAsString
public final String granularityAsString()
Sets the Amazon Web Services cost granularity to
MONTHLYorDAILY, orHOURLY. IfGranularityisn't set, the response object doesn't include theGranularity, eitherMONTHLYorDAILY, orHOURLY.If the service returns an enum value that is not available in the current SDK version,
granularitywill returnGranularity.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available fromgranularityAsString().- Returns:
- Sets the Amazon Web Services cost granularity to
MONTHLYorDAILY, orHOURLY. IfGranularityisn't set, the response object doesn't include theGranularity, eitherMONTHLYorDAILY, orHOURLY. - See Also:
Granularity
-
filter
public final Expression filter()
Filters Amazon Web Services costs by different dimensions. For example, you can specify
SERVICEandLINKED_ACCOUNTand get the costs that are associated with that account's usage of that service. You can nestExpressionobjects to define any combination of dimension filters. For more information, see Expression.Valid values for
MatchOptionsforDimensionsareEQUALSandCASE_SENSITIVE.Valid values for
MatchOptionsforCostCategoriesandTagsareEQUALS,ABSENT, andCASE_SENSITIVE. Default values areEQUALSandCASE_SENSITIVE.- Returns:
- Filters Amazon Web Services costs by different dimensions. For example, you can specify
SERVICEandLINKED_ACCOUNTand get the costs that are associated with that account's usage of that service. You can nestExpressionobjects to define any combination of dimension filters. For more information, see Expression.Valid values for
MatchOptionsforDimensionsareEQUALSandCASE_SENSITIVE.Valid values for
MatchOptionsforCostCategoriesandTagsareEQUALS,ABSENT, andCASE_SENSITIVE. Default values areEQUALSandCASE_SENSITIVE.
-
hasMetrics
public final boolean hasMetrics()
For responses, this returns true if the service returned a value for the Metrics property. This DOES NOT check that the value is non-empty (for which, you should check theisEmpty()method on the property). This is useful because the SDK will never return a null collection or map, but you may need to differentiate between the service returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true if a value for the property was specified in the request builder, and false if a value was not specified.
-
metrics
public final List<String> 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, andUsageQuantity.If you return the
UsageQuantitymetric, the service aggregates all usage numbers without taking into account the units. For example, if you aggregateusageQuantityacross 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 and GB). To get more meaningfulUsageQuantitymetrics, filter byUsageTypeorUsageTypeGroups.Metricsis required forGetCostAndUsagerequests.Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
This method will never return null. If you would like to know whether the service returned this field (so that you can differentiate between null and empty), you can use the
hasMetrics()method.- Returns:
- 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, andUsageQuantity.If you return the
UsageQuantitymetric, the service aggregates all usage numbers without taking into account the units. For example, if you aggregateusageQuantityacross 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 and GB). To get more meaningfulUsageQuantitymetrics, filter byUsageTypeorUsageTypeGroups.Metricsis required forGetCostAndUsagerequests.
-
hasGroupBy
public final boolean hasGroupBy()
For responses, this returns true if the service returned a value for the GroupBy property. This DOES NOT check that the value is non-empty (for which, you should check theisEmpty()method on the property). This is useful because the SDK will never return a null collection or map, but you may need to differentiate between the service returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true if a value for the property was specified in the request builder, and false if a value was not specified.
-
groupBy
public final List<GroupDefinition> groupBy()
You can group Amazon Web Services costs using up to two different groups, either dimensions, tag keys, cost categories, or any two group by types.
Valid values for the
DIMENSIONtype areAZ,INSTANCE_TYPE,LEGAL_ENTITY_NAME,INVOICING_ENTITY,LINKED_ACCOUNT,OPERATION,PLATFORM,PURCHASE_TYPE,SERVICE,TENANCY,RECORD_TYPE, andUSAGE_TYPE.When you group by the
TAGtype and include a valid tag key, you get all tag values, including empty strings.Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
This method will never return null. If you would like to know whether the service returned this field (so that you can differentiate between null and empty), you can use the
hasGroupBy()method.- Returns:
- You can group Amazon Web Services costs using up to two different groups, either dimensions, tag keys,
cost categories, or any two group by types.
Valid values for the
DIMENSIONtype areAZ,INSTANCE_TYPE,LEGAL_ENTITY_NAME,INVOICING_ENTITY,LINKED_ACCOUNT,OPERATION,PLATFORM,PURCHASE_TYPE,SERVICE,TENANCY,RECORD_TYPE, andUSAGE_TYPE.When you group by the
TAGtype and include a valid tag key, you get all tag values, including empty strings.
-
nextPageToken
public final String 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.
- Returns:
- 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.
-
toBuilder
public GetCostAndUsageRequest.Builder toBuilder()
- Specified by:
toBuilderin interfaceToCopyableBuilder<GetCostAndUsageRequest.Builder,GetCostAndUsageRequest>- Specified by:
toBuilderin classCostExplorerRequest
-
builder
public static GetCostAndUsageRequest.Builder builder()
-
serializableBuilderClass
public static Class<? extends GetCostAndUsageRequest.Builder> serializableBuilderClass()
-
hashCode
public final int hashCode()
- Overrides:
hashCodein classAwsRequest
-
equals
public final boolean equals(Object obj)
- Overrides:
equalsin classAwsRequest
-
equalsBySdkFields
public final boolean equalsBySdkFields(Object obj)
- Specified by:
equalsBySdkFieldsin interfaceSdkPojo
-
toString
public final String toString()
Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be redacted from this string using a placeholder value.
-
getValueForField
public final <T> Optional<T> getValueForField(String fieldName, Class<T> clazz)
- Overrides:
getValueForFieldin classSdkRequest
-
-