Interface CostAndUsageReportClient
- All Superinterfaces:
AutoCloseable,AwsClient,SdkAutoCloseable,SdkClient
builder() method.
You can use the Amazon Web Services Cost and Usage Report API to programmatically create, query, and delete Amazon Web Services Cost and Usage Report definitions.
Amazon Web Services Cost and Usage Report track the monthly Amazon Web Services costs and usage associated with your Amazon Web Services account. The report contains line items for each unique combination of Amazon Web Services product, usage type, and operation that your Amazon Web Services account uses. You can configure the Amazon Web Services Cost and Usage Report to show only the data that you want, using the Amazon Web Services Cost and Usage Report API.
Service Endpoint
The Amazon Web Services Cost and Usage Report API provides the following endpoint:
-
cur.us-east-1.amazonaws.com
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringValue for looking up the service's metadata from theServiceMetadataProvider.static final String -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Create a builder that can be used to configure and create aCostAndUsageReportClient.static CostAndUsageReportClientcreate()Create aCostAndUsageReportClientwith the region loaded from theDefaultAwsRegionProviderChainand credentials loaded from theDefaultCredentialsProvider.default DeleteReportDefinitionResponsedeleteReportDefinition(Consumer<DeleteReportDefinitionRequest.Builder> deleteReportDefinitionRequest) Deletes the specified report.default DeleteReportDefinitionResponsedeleteReportDefinition(DeleteReportDefinitionRequest deleteReportDefinitionRequest) Deletes the specified report.Lists the Amazon Web Services Cost and Usage Report available to this account.describeReportDefinitions(Consumer<DescribeReportDefinitionsRequest.Builder> describeReportDefinitionsRequest) Lists the Amazon Web Services Cost and Usage Report available to this account.describeReportDefinitions(DescribeReportDefinitionsRequest describeReportDefinitionsRequest) Lists the Amazon Web Services Cost and Usage Report available to this account.This is a variant ofdescribeReportDefinitions(software.amazon.awssdk.services.costandusagereport.model.DescribeReportDefinitionsRequest)operation.describeReportDefinitionsPaginator(Consumer<DescribeReportDefinitionsRequest.Builder> describeReportDefinitionsRequest) This is a variant ofdescribeReportDefinitions(software.amazon.awssdk.services.costandusagereport.model.DescribeReportDefinitionsRequest)operation.describeReportDefinitionsPaginator(DescribeReportDefinitionsRequest describeReportDefinitionsRequest) This is a variant ofdescribeReportDefinitions(software.amazon.awssdk.services.costandusagereport.model.DescribeReportDefinitionsRequest)operation.default ListTagsForResourceResponselistTagsForResource(Consumer<ListTagsForResourceRequest.Builder> listTagsForResourceRequest) Lists the tags associated with the specified report definition.default ListTagsForResourceResponselistTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest) Lists the tags associated with the specified report definition.default ModifyReportDefinitionResponsemodifyReportDefinition(Consumer<ModifyReportDefinitionRequest.Builder> modifyReportDefinitionRequest) Allows you to programmatically update your report preferences.default ModifyReportDefinitionResponsemodifyReportDefinition(ModifyReportDefinitionRequest modifyReportDefinitionRequest) Allows you to programmatically update your report preferences.default PutReportDefinitionResponseputReportDefinition(Consumer<PutReportDefinitionRequest.Builder> putReportDefinitionRequest) Creates a new report using the description that you provide.default PutReportDefinitionResponseputReportDefinition(PutReportDefinitionRequest putReportDefinitionRequest) Creates a new report using the description that you provide.The SDK service client configuration exposes client settings to the user, e.g., ClientOverrideConfigurationstatic ServiceMetadatadefault TagResourceResponsetagResource(Consumer<TagResourceRequest.Builder> tagResourceRequest) Associates a set of tags with a report definition.default TagResourceResponsetagResource(TagResourceRequest tagResourceRequest) Associates a set of tags with a report definition.default UntagResourceResponseuntagResource(Consumer<UntagResourceRequest.Builder> untagResourceRequest) Disassociates a set of tags from a report definition.default UntagResourceResponseuntagResource(UntagResourceRequest untagResourceRequest) Disassociates a set of tags from a report definition.Methods inherited from interface software.amazon.awssdk.utils.SdkAutoCloseable
closeMethods inherited from interface software.amazon.awssdk.core.SdkClient
serviceName
-
Field Details
-
SERVICE_NAME
- See Also:
-
SERVICE_METADATA_ID
Value for looking up the service's metadata from theServiceMetadataProvider.- See Also:
-
-
Method Details
-
deleteReportDefinition
default DeleteReportDefinitionResponse deleteReportDefinition(DeleteReportDefinitionRequest deleteReportDefinitionRequest) throws InternalErrorException, ValidationException, AwsServiceException, SdkClientException, CostAndUsageReportException Deletes the specified report. Any tags associated with the report are also deleted.
- Parameters:
deleteReportDefinitionRequest- Deletes the specified report.- Returns:
- Result of the DeleteReportDefinition operation returned by the service.
- See Also:
-
deleteReportDefinition
default DeleteReportDefinitionResponse deleteReportDefinition(Consumer<DeleteReportDefinitionRequest.Builder> deleteReportDefinitionRequest) throws InternalErrorException, ValidationException, AwsServiceException, SdkClientException, CostAndUsageReportException Deletes the specified report. Any tags associated with the report are also deleted.
This is a convenience which creates an instance of the
DeleteReportDefinitionRequest.Builderavoiding the need to create one manually viaDeleteReportDefinitionRequest.builder()- Parameters:
deleteReportDefinitionRequest- AConsumerthat will call methods onDeleteReportDefinitionRequest.Builderto create a request. Deletes the specified report.- Returns:
- Result of the DeleteReportDefinition operation returned by the service.
- See Also:
-
describeReportDefinitions
default DescribeReportDefinitionsResponse describeReportDefinitions(DescribeReportDefinitionsRequest describeReportDefinitionsRequest) throws InternalErrorException, AwsServiceException, SdkClientException, CostAndUsageReportException Lists the Amazon Web Services Cost and Usage Report available to this account.
- Parameters:
describeReportDefinitionsRequest- Requests a Amazon Web Services Cost and Usage Report list owned by the account.- Returns:
- Result of the DescribeReportDefinitions operation returned by the service.
- See Also:
-
describeReportDefinitions
default DescribeReportDefinitionsResponse describeReportDefinitions(Consumer<DescribeReportDefinitionsRequest.Builder> describeReportDefinitionsRequest) throws InternalErrorException, AwsServiceException, SdkClientException, CostAndUsageReportException Lists the Amazon Web Services Cost and Usage Report available to this account.
This is a convenience which creates an instance of the
DescribeReportDefinitionsRequest.Builderavoiding the need to create one manually viaDescribeReportDefinitionsRequest.builder()- Parameters:
describeReportDefinitionsRequest- AConsumerthat will call methods onDescribeReportDefinitionsRequest.Builderto create a request. Requests a Amazon Web Services Cost and Usage Report list owned by the account.- Returns:
- Result of the DescribeReportDefinitions operation returned by the service.
- See Also:
-
describeReportDefinitions
default DescribeReportDefinitionsResponse describeReportDefinitions() throws InternalErrorException, AwsServiceException, SdkClientException, CostAndUsageReportExceptionLists the Amazon Web Services Cost and Usage Report available to this account.
- Returns:
- Result of the DescribeReportDefinitions operation returned by the service.
- See Also:
-
describeReportDefinitionsPaginator
default DescribeReportDefinitionsIterable describeReportDefinitionsPaginator() throws InternalErrorException, AwsServiceException, SdkClientException, CostAndUsageReportExceptionThis is a variant of
describeReportDefinitions(software.amazon.awssdk.services.costandusagereport.model.DescribeReportDefinitionsRequest)operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will internally handle making service calls for you.When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response pages by making service calls until there are no pages left or your iteration stops. If there are errors in your request, you will see the failures only after you start iterating through the iterable.
The following are few ways to iterate through the response pages:
1) Using a Stream
2) Using For loopsoftware.amazon.awssdk.services.costandusagereport.paginators.DescribeReportDefinitionsIterable responses = client.describeReportDefinitionsPaginator(request); responses.stream().forEach(....);{ @code software.amazon.awssdk.services.costandusagereport.paginators.DescribeReportDefinitionsIterable responses = client .describeReportDefinitionsPaginator(request); for (software.amazon.awssdk.services.costandusagereport.model.DescribeReportDefinitionsResponse response : responses) { // do something; } }3) Use iterator directlysoftware.amazon.awssdk.services.costandusagereport.paginators.DescribeReportDefinitionsIterable responses = client.describeReportDefinitionsPaginator(request); responses.iterator().forEachRemaining(....);Please notice that the configuration of MaxResults won't limit the number of results you get with the paginator. It only limits the number of results in each page.
Note: If you prefer to have control on service calls, use the
describeReportDefinitions(software.amazon.awssdk.services.costandusagereport.model.DescribeReportDefinitionsRequest)operation.- Returns:
- A custom iterable that can be used to iterate through all the response pages.
- See Also:
-
describeReportDefinitionsPaginator
default DescribeReportDefinitionsIterable describeReportDefinitionsPaginator(DescribeReportDefinitionsRequest describeReportDefinitionsRequest) throws InternalErrorException, AwsServiceException, SdkClientException, CostAndUsageReportException This is a variant of
describeReportDefinitions(software.amazon.awssdk.services.costandusagereport.model.DescribeReportDefinitionsRequest)operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will internally handle making service calls for you.When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response pages by making service calls until there are no pages left or your iteration stops. If there are errors in your request, you will see the failures only after you start iterating through the iterable.
The following are few ways to iterate through the response pages:
1) Using a Stream
2) Using For loopsoftware.amazon.awssdk.services.costandusagereport.paginators.DescribeReportDefinitionsIterable responses = client.describeReportDefinitionsPaginator(request); responses.stream().forEach(....);{ @code software.amazon.awssdk.services.costandusagereport.paginators.DescribeReportDefinitionsIterable responses = client .describeReportDefinitionsPaginator(request); for (software.amazon.awssdk.services.costandusagereport.model.DescribeReportDefinitionsResponse response : responses) { // do something; } }3) Use iterator directlysoftware.amazon.awssdk.services.costandusagereport.paginators.DescribeReportDefinitionsIterable responses = client.describeReportDefinitionsPaginator(request); responses.iterator().forEachRemaining(....);Please notice that the configuration of MaxResults won't limit the number of results you get with the paginator. It only limits the number of results in each page.
Note: If you prefer to have control on service calls, use the
describeReportDefinitions(software.amazon.awssdk.services.costandusagereport.model.DescribeReportDefinitionsRequest)operation.- Parameters:
describeReportDefinitionsRequest- Requests a Amazon Web Services Cost and Usage Report list owned by the account.- Returns:
- A custom iterable that can be used to iterate through all the response pages.
- See Also:
-
describeReportDefinitionsPaginator
default DescribeReportDefinitionsIterable describeReportDefinitionsPaginator(Consumer<DescribeReportDefinitionsRequest.Builder> describeReportDefinitionsRequest) throws InternalErrorException, AwsServiceException, SdkClientException, CostAndUsageReportException This is a variant of
describeReportDefinitions(software.amazon.awssdk.services.costandusagereport.model.DescribeReportDefinitionsRequest)operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will internally handle making service calls for you.When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response pages by making service calls until there are no pages left or your iteration stops. If there are errors in your request, you will see the failures only after you start iterating through the iterable.
The following are few ways to iterate through the response pages:
1) Using a Stream
2) Using For loopsoftware.amazon.awssdk.services.costandusagereport.paginators.DescribeReportDefinitionsIterable responses = client.describeReportDefinitionsPaginator(request); responses.stream().forEach(....);{ @code software.amazon.awssdk.services.costandusagereport.paginators.DescribeReportDefinitionsIterable responses = client .describeReportDefinitionsPaginator(request); for (software.amazon.awssdk.services.costandusagereport.model.DescribeReportDefinitionsResponse response : responses) { // do something; } }3) Use iterator directlysoftware.amazon.awssdk.services.costandusagereport.paginators.DescribeReportDefinitionsIterable responses = client.describeReportDefinitionsPaginator(request); responses.iterator().forEachRemaining(....);Please notice that the configuration of MaxResults won't limit the number of results you get with the paginator. It only limits the number of results in each page.
Note: If you prefer to have control on service calls, use the
describeReportDefinitions(software.amazon.awssdk.services.costandusagereport.model.DescribeReportDefinitionsRequest)operation.
This is a convenience which creates an instance of the
DescribeReportDefinitionsRequest.Builderavoiding the need to create one manually viaDescribeReportDefinitionsRequest.builder()- Parameters:
describeReportDefinitionsRequest- AConsumerthat will call methods onDescribeReportDefinitionsRequest.Builderto create a request. Requests a Amazon Web Services Cost and Usage Report list owned by the account.- Returns:
- A custom iterable that can be used to iterate through all the response pages.
- See Also:
-
listTagsForResource
default ListTagsForResourceResponse listTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest) throws ResourceNotFoundException, InternalErrorException, ValidationException, AwsServiceException, SdkClientException, CostAndUsageReportException Lists the tags associated with the specified report definition.
- Parameters:
listTagsForResourceRequest-- Returns:
- Result of the ListTagsForResource operation returned by the service.
- See Also:
-
listTagsForResource
default ListTagsForResourceResponse listTagsForResource(Consumer<ListTagsForResourceRequest.Builder> listTagsForResourceRequest) throws ResourceNotFoundException, InternalErrorException, ValidationException, AwsServiceException, SdkClientException, CostAndUsageReportException Lists the tags associated with the specified report definition.
This is a convenience which creates an instance of the
ListTagsForResourceRequest.Builderavoiding the need to create one manually viaListTagsForResourceRequest.builder()- Parameters:
listTagsForResourceRequest- AConsumerthat will call methods onListTagsForResourceRequest.Builderto create a request.- Returns:
- Result of the ListTagsForResource operation returned by the service.
- See Also:
-
modifyReportDefinition
default ModifyReportDefinitionResponse modifyReportDefinition(ModifyReportDefinitionRequest modifyReportDefinitionRequest) throws InternalErrorException, ValidationException, AwsServiceException, SdkClientException, CostAndUsageReportException Allows you to programmatically update your report preferences.
- Parameters:
modifyReportDefinitionRequest-- Returns:
- Result of the ModifyReportDefinition operation returned by the service.
- See Also:
-
modifyReportDefinition
default ModifyReportDefinitionResponse modifyReportDefinition(Consumer<ModifyReportDefinitionRequest.Builder> modifyReportDefinitionRequest) throws InternalErrorException, ValidationException, AwsServiceException, SdkClientException, CostAndUsageReportException Allows you to programmatically update your report preferences.
This is a convenience which creates an instance of the
ModifyReportDefinitionRequest.Builderavoiding the need to create one manually viaModifyReportDefinitionRequest.builder()- Parameters:
modifyReportDefinitionRequest- AConsumerthat will call methods onModifyReportDefinitionRequest.Builderto create a request.- Returns:
- Result of the ModifyReportDefinition operation returned by the service.
- See Also:
-
putReportDefinition
default PutReportDefinitionResponse putReportDefinition(PutReportDefinitionRequest putReportDefinitionRequest) throws DuplicateReportNameException, ReportLimitReachedException, InternalErrorException, ValidationException, ResourceNotFoundException, AwsServiceException, SdkClientException, CostAndUsageReportException Creates a new report using the description that you provide.
- Parameters:
putReportDefinitionRequest- Creates a Cost and Usage Report.- Returns:
- Result of the PutReportDefinition operation returned by the service.
- See Also:
-
putReportDefinition
default PutReportDefinitionResponse putReportDefinition(Consumer<PutReportDefinitionRequest.Builder> putReportDefinitionRequest) throws DuplicateReportNameException, ReportLimitReachedException, InternalErrorException, ValidationException, ResourceNotFoundException, AwsServiceException, SdkClientException, CostAndUsageReportException Creates a new report using the description that you provide.
This is a convenience which creates an instance of the
PutReportDefinitionRequest.Builderavoiding the need to create one manually viaPutReportDefinitionRequest.builder()- Parameters:
putReportDefinitionRequest- AConsumerthat will call methods onPutReportDefinitionRequest.Builderto create a request. Creates a Cost and Usage Report.- Returns:
- Result of the PutReportDefinition operation returned by the service.
- See Also:
-
tagResource
default TagResourceResponse tagResource(TagResourceRequest tagResourceRequest) throws ResourceNotFoundException, InternalErrorException, ValidationException, AwsServiceException, SdkClientException, CostAndUsageReportException Associates a set of tags with a report definition.
- Parameters:
tagResourceRequest-- Returns:
- Result of the TagResource operation returned by the service.
- See Also:
-
tagResource
default TagResourceResponse tagResource(Consumer<TagResourceRequest.Builder> tagResourceRequest) throws ResourceNotFoundException, InternalErrorException, ValidationException, AwsServiceException, SdkClientException, CostAndUsageReportException Associates a set of tags with a report definition.
This is a convenience which creates an instance of the
TagResourceRequest.Builderavoiding the need to create one manually viaTagResourceRequest.builder()- Parameters:
tagResourceRequest- AConsumerthat will call methods onTagResourceRequest.Builderto create a request.- Returns:
- Result of the TagResource operation returned by the service.
- See Also:
-
untagResource
default UntagResourceResponse untagResource(UntagResourceRequest untagResourceRequest) throws ResourceNotFoundException, InternalErrorException, ValidationException, AwsServiceException, SdkClientException, CostAndUsageReportException Disassociates a set of tags from a report definition.
- Parameters:
untagResourceRequest-- Returns:
- Result of the UntagResource operation returned by the service.
- See Also:
-
untagResource
default UntagResourceResponse untagResource(Consumer<UntagResourceRequest.Builder> untagResourceRequest) throws ResourceNotFoundException, InternalErrorException, ValidationException, AwsServiceException, SdkClientException, CostAndUsageReportException Disassociates a set of tags from a report definition.
This is a convenience which creates an instance of the
UntagResourceRequest.Builderavoiding the need to create one manually viaUntagResourceRequest.builder()- Parameters:
untagResourceRequest- AConsumerthat will call methods onUntagResourceRequest.Builderto create a request.- Returns:
- Result of the UntagResource operation returned by the service.
- See Also:
-
create
Create aCostAndUsageReportClientwith the region loaded from theDefaultAwsRegionProviderChainand credentials loaded from theDefaultCredentialsProvider. -
builder
Create a builder that can be used to configure and create aCostAndUsageReportClient. -
serviceMetadata
-
serviceClientConfiguration
Description copied from interface:SdkClientThe SDK service client configuration exposes client settings to the user, e.g., ClientOverrideConfiguration- Specified by:
serviceClientConfigurationin interfaceAwsClient- Specified by:
serviceClientConfigurationin interfaceSdkClient- Returns:
- SdkServiceClientConfiguration
-