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 StringValue for looking up the service's metadata from theServiceMetadataProvider.static final String -
Method Summary
Modifier and TypeMethodDescriptionstatic BillingClientBuilderbuilder()Create a builder that can be used to configure and create aBillingClient.static BillingClientcreate()Create aBillingClientwith the region loaded from theDefaultAwsRegionProviderChainand credentials loaded from theDefaultCredentialsProvider.default ListBillingViewsResponselistBillingViews(Consumer<ListBillingViewsRequest.Builder> listBillingViewsRequest) Lists the billing views available for a given time period.default ListBillingViewsResponselistBillingViews(ListBillingViewsRequest listBillingViewsRequest) Lists the billing views available for a given time period.default ListBillingViewsIterablelistBillingViewsPaginator(Consumer<ListBillingViewsRequest.Builder> listBillingViewsRequest) This is a variant oflistBillingViews(software.amazon.awssdk.services.billing.model.ListBillingViewsRequest)operation.default ListBillingViewsIterablelistBillingViewsPaginator(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 ServiceMetadataMethods 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
-
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
PRIMARYbilling view that represents the billing data available by default. Accounts that use Billing Conductor also haveBILLING_GROUPbilling 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
PRIMARYbilling view that represents the billing data available by default. Accounts that use Billing Conductor also haveBILLING_GROUPbilling views representing pro forma costs associated with each created billing group.
This is a convenience which creates an instance of the
ListBillingViewsRequest.Builderavoiding the need to create one manually viaListBillingViewsRequest.builder()- Parameters:
listBillingViewsRequest- AConsumerthat will call methods onListBillingViewsRequest.Builderto 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 Stream
2) Using For loopsoftware.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 Stream
2) Using For loopsoftware.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.Builderavoiding the need to create one manually viaListBillingViewsRequest.builder()- Parameters:
listBillingViewsRequest- AConsumerthat will call methods onListBillingViewsRequest.Builderto create a request.- Returns:
- A custom iterable that can be used to iterate through all the response pages.
- See Also:
-
create
Create aBillingClientwith the region loaded from theDefaultAwsRegionProviderChainand credentials loaded from theDefaultCredentialsProvider. -
builder
Create a builder that can be used to configure and create aBillingClient. -
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
-