Interface BillingClient
- All Superinterfaces:
AutoCloseable
,AwsClient
,SdkAutoCloseable
,SdkClient
builder()
method.
You can use the Billing API to programatically list the billing views available to you for a given time period. A billing view represents a set of billing data.
The Billing API provides the following endpoint:
https://billing.us-east-1.api.aws
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Value for looking up the service's metadata from theServiceMetadataProvider
.static final String
-
Method Summary
Modifier and TypeMethodDescriptionstatic BillingClientBuilder
builder()
Create a builder that can be used to configure and create aBillingClient
.static BillingClient
create()
Create aBillingClient
with the region loaded from theDefaultAwsRegionProviderChain
and credentials loaded from theDefaultCredentialsProvider
.default ListBillingViewsResponse
listBillingViews
(Consumer<ListBillingViewsRequest.Builder> listBillingViewsRequest) Lists the billing views available for a given time period.default ListBillingViewsResponse
listBillingViews
(ListBillingViewsRequest listBillingViewsRequest) Lists the billing views available for a given time period.default ListBillingViewsIterable
listBillingViewsPaginator
(Consumer<ListBillingViewsRequest.Builder> listBillingViewsRequest) This is a variant oflistBillingViews(software.amazon.awssdk.services.billing.model.ListBillingViewsRequest)
operation.default ListBillingViewsIterable
listBillingViewsPaginator
(ListBillingViewsRequest listBillingViewsRequest) This is a variant oflistBillingViews(software.amazon.awssdk.services.billing.model.ListBillingViewsRequest)
operation.The SDK service client configuration exposes client settings to the user, e.g., ClientOverrideConfigurationstatic ServiceMetadata
Methods inherited from interface software.amazon.awssdk.utils.SdkAutoCloseable
close
Methods 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
-
listBillingViews
default ListBillingViewsResponse listBillingViews(ListBillingViewsRequest listBillingViewsRequest) throws ThrottlingException, AccessDeniedException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, BillingException Lists the billing views available for a given time period.
Every Amazon Web Services account has a unique
PRIMARY
billing view that represents the billing data available by default. Accounts that use Billing Conductor also haveBILLING_GROUP
billing views representing pro forma costs associated with each created billing group.- Parameters:
listBillingViewsRequest
-- Returns:
- Result of the ListBillingViews operation returned by the service.
- See Also:
-
listBillingViews
default ListBillingViewsResponse listBillingViews(Consumer<ListBillingViewsRequest.Builder> listBillingViewsRequest) throws ThrottlingException, AccessDeniedException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, BillingException Lists the billing views available for a given time period.
Every Amazon Web Services account has a unique
PRIMARY
billing view that represents the billing data available by default. Accounts that use Billing Conductor also haveBILLING_GROUP
billing views representing pro forma costs associated with each created billing group.
This is a convenience which creates an instance of the
ListBillingViewsRequest.Builder
avoiding the need to create one manually viaListBillingViewsRequest.builder()
- Parameters:
listBillingViewsRequest
- AConsumer
that will call methods onListBillingViewsRequest.Builder
to create a request.- Returns:
- Result of the ListBillingViews operation returned by the service.
- See Also:
-
listBillingViewsPaginator
default ListBillingViewsIterable listBillingViewsPaginator(ListBillingViewsRequest listBillingViewsRequest) throws ThrottlingException, AccessDeniedException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, BillingException This is a variant of
listBillingViews(software.amazon.awssdk.services.billing.model.ListBillingViewsRequest)
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 Streamsoftware.amazon.awssdk.services.billing.paginators.ListBillingViewsIterable responses = client.listBillingViewsPaginator(request); responses.stream().forEach(....);
{ @code software.amazon.awssdk.services.billing.paginators.ListBillingViewsIterable responses = client .listBillingViewsPaginator(request); for (software.amazon.awssdk.services.billing.model.ListBillingViewsResponse response : responses) { // do something; } }
3) Use iterator directlysoftware.amazon.awssdk.services.billing.paginators.ListBillingViewsIterable responses = client.listBillingViewsPaginator(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
listBillingViews(software.amazon.awssdk.services.billing.model.ListBillingViewsRequest)
operation.- Parameters:
listBillingViewsRequest
-- Returns:
- A custom iterable that can be used to iterate through all the response pages.
- See Also:
-
listBillingViewsPaginator
default ListBillingViewsIterable listBillingViewsPaginator(Consumer<ListBillingViewsRequest.Builder> listBillingViewsRequest) throws ThrottlingException, AccessDeniedException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, BillingException This is a variant of
listBillingViews(software.amazon.awssdk.services.billing.model.ListBillingViewsRequest)
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 Streamsoftware.amazon.awssdk.services.billing.paginators.ListBillingViewsIterable responses = client.listBillingViewsPaginator(request); responses.stream().forEach(....);
{ @code software.amazon.awssdk.services.billing.paginators.ListBillingViewsIterable responses = client .listBillingViewsPaginator(request); for (software.amazon.awssdk.services.billing.model.ListBillingViewsResponse response : responses) { // do something; } }
3) Use iterator directlysoftware.amazon.awssdk.services.billing.paginators.ListBillingViewsIterable responses = client.listBillingViewsPaginator(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
listBillingViews(software.amazon.awssdk.services.billing.model.ListBillingViewsRequest)
operation.
This is a convenience which creates an instance of the
ListBillingViewsRequest.Builder
avoiding the need to create one manually viaListBillingViewsRequest.builder()
- Parameters:
listBillingViewsRequest
- AConsumer
that will call methods onListBillingViewsRequest.Builder
to create a request.- Returns:
- A custom iterable that can be used to iterate through all the response pages.
- See Also:
-
create
Create aBillingClient
with the region loaded from theDefaultAwsRegionProviderChain
and credentials loaded from theDefaultCredentialsProvider
. -
builder
Create a builder that can be used to configure and create aBillingClient
. -
serviceMetadata
-
serviceClientConfiguration
Description copied from interface:SdkClient
The SDK service client configuration exposes client settings to the user, e.g., ClientOverrideConfiguration- Specified by:
serviceClientConfiguration
in interfaceAwsClient
- Specified by:
serviceClientConfiguration
in interfaceSdkClient
- Returns:
- SdkServiceClientConfiguration
-