All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.costexplorer.model.GetCostAndUsageRequest Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS Cost Explorer module holds the client classes that are used for communicating with AWS Cost Explorer Service

There is a newer version: 2.28.4
Show newest version
/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */

package software.amazon.awssdk.services.costexplorer.model;

import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 */
@Generated("software.amazon.awssdk:codegen")
public final class GetCostAndUsageRequest extends CostExplorerRequest implements
        ToCopyableBuilder {
    private static final SdkField TIME_PERIOD_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
            .memberName("TimePeriod").getter(getter(GetCostAndUsageRequest::timePeriod)).setter(setter(Builder::timePeriod))
            .constructor(DateInterval::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TimePeriod").build()).build();

    private static final SdkField GRANULARITY_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("Granularity").getter(getter(GetCostAndUsageRequest::granularityAsString))
            .setter(setter(Builder::granularity))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Granularity").build()).build();

    private static final SdkField FILTER_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
            .memberName("Filter").getter(getter(GetCostAndUsageRequest::filter)).setter(setter(Builder::filter))
            .constructor(Expression::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Filter").build()).build();

    private static final SdkField> METRICS_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("Metrics")
            .getter(getter(GetCostAndUsageRequest::metrics))
            .setter(setter(Builder::metrics))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Metrics").build(),
                    ListTrait
                            .builder()
                            .memberLocationName(null)
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.STRING)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("member").build()).build()).build()).build();

    private static final SdkField> GROUP_BY_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("GroupBy")
            .getter(getter(GetCostAndUsageRequest::groupBy))
            .setter(setter(Builder::groupBy))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GroupBy").build(),
                    ListTrait
                            .builder()
                            .memberLocationName(null)
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.SDK_POJO)
                                            .constructor(GroupDefinition::builder)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("member").build()).build()).build()).build();

    private static final SdkField NEXT_PAGE_TOKEN_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("NextPageToken").getter(getter(GetCostAndUsageRequest::nextPageToken))
            .setter(setter(Builder::nextPageToken))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NextPageToken").build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TIME_PERIOD_FIELD,
            GRANULARITY_FIELD, FILTER_FIELD, METRICS_FIELD, GROUP_BY_FIELD, NEXT_PAGE_TOKEN_FIELD));

    private final DateInterval timePeriod;

    private final String granularity;

    private final Expression filter;

    private final List metrics;

    private final List groupBy;

    private final String nextPageToken;

    private GetCostAndUsageRequest(BuilderImpl builder) {
        super(builder);
        this.timePeriod = builder.timePeriod;
        this.granularity = builder.granularity;
        this.filter = builder.filter;
        this.metrics = builder.metrics;
        this.groupBy = builder.groupBy;
        this.nextPageToken = builder.nextPageToken;
    }

    /**
     * 

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

* * @return 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 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. */ public final DateInterval timePeriod() { return timePeriod; } /** *

* Sets the Amazon Web Services cost granularity to MONTHLY or DAILY, or * HOURLY. If Granularity isn't set, the response object doesn't include the * Granularity, either MONTHLY or DAILY, or HOURLY. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #granularity} will * return {@link Granularity#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #granularityAsString}. *

* * @return Sets the Amazon Web Services cost granularity to MONTHLY or DAILY, or * HOURLY. If Granularity isn't set, the response object doesn't include the * Granularity, either MONTHLY or DAILY, or HOURLY. * @see Granularity */ public final Granularity granularity() { return Granularity.fromValue(granularity); } /** *

* Sets the Amazon Web Services cost granularity to MONTHLY or DAILY, or * HOURLY. If Granularity isn't set, the response object doesn't include the * Granularity, either MONTHLY or DAILY, or HOURLY. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #granularity} will * return {@link Granularity#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #granularityAsString}. *

* * @return Sets the Amazon Web Services cost granularity to MONTHLY or DAILY, or * HOURLY. If Granularity isn't set, the response object doesn't include the * Granularity, either MONTHLY or DAILY, or HOURLY. * @see Granularity */ public final String granularityAsString() { return granularity; } /** *

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

*

* Valid values for MatchOptions for Dimensions are EQUALS and * CASE_SENSITIVE. *

*

* Valid values for MatchOptions for CostCategories and Tags are * EQUALS, ABSENT, and CASE_SENSITIVE. Default values are EQUALS * and CASE_SENSITIVE. *

* * @return 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.

*

* Valid values for MatchOptions for Dimensions are EQUALS and * CASE_SENSITIVE. *

*

* Valid values for MatchOptions for CostCategories and Tags are * EQUALS, ABSENT, and CASE_SENSITIVE. Default values are * EQUALS and CASE_SENSITIVE. */ public final Expression filter() { return filter; } /** * 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 the {@code isEmpty()} 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. */ public final boolean hasMetrics() { return metrics != null && !(metrics instanceof SdkAutoConstructList); } /** *

* 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 into * account the units. 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 and GB). To get more meaningful UsageQuantity metrics, filter by * UsageType or UsageTypeGroups. *

*
*

* Metrics is required for GetCostAndUsage requests. *

*

* 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 {@link #hasMetrics} method. *

* * @return 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 into account the units. 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 and GB). To get more meaningful UsageQuantity * metrics, filter by UsageType or UsageTypeGroups. *

*
*

* Metrics is required for GetCostAndUsage requests. */ public final List metrics() { return metrics; } /** * 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 the {@code isEmpty()} 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. */ public final boolean hasGroupBy() { return groupBy != null && !(groupBy instanceof SdkAutoConstructList); } /** *

* 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 DIMENSION type are AZ, INSTANCE_TYPE, * LEGAL_ENTITY_NAME, INVOICING_ENTITY, LINKED_ACCOUNT, * OPERATION, PLATFORM, PURCHASE_TYPE, SERVICE, * TENANCY, RECORD_TYPE, and USAGE_TYPE. *

*

* When you group by the TAG type 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 {@link #hasGroupBy} method. *

* * @return 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 DIMENSION type are AZ, INSTANCE_TYPE, * LEGAL_ENTITY_NAME, INVOICING_ENTITY, LINKED_ACCOUNT, * OPERATION, PLATFORM, PURCHASE_TYPE, SERVICE, * TENANCY, RECORD_TYPE, and USAGE_TYPE. *

*

* When you group by the TAG type and include a valid tag key, you get all tag values, * including empty strings. */ public final List groupBy() { return groupBy; } /** *

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

* * @return 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. */ public final String nextPageToken() { return nextPageToken; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(timePeriod()); hashCode = 31 * hashCode + Objects.hashCode(granularityAsString()); hashCode = 31 * hashCode + Objects.hashCode(filter()); hashCode = 31 * hashCode + Objects.hashCode(hasMetrics() ? metrics() : null); hashCode = 31 * hashCode + Objects.hashCode(hasGroupBy() ? groupBy() : null); hashCode = 31 * hashCode + Objects.hashCode(nextPageToken()); return hashCode; } @Override public final boolean equals(Object obj) { return super.equals(obj) && equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof GetCostAndUsageRequest)) { return false; } GetCostAndUsageRequest other = (GetCostAndUsageRequest) obj; return Objects.equals(timePeriod(), other.timePeriod()) && Objects.equals(granularityAsString(), other.granularityAsString()) && Objects.equals(filter(), other.filter()) && hasMetrics() == other.hasMetrics() && Objects.equals(metrics(), other.metrics()) && hasGroupBy() == other.hasGroupBy() && Objects.equals(groupBy(), other.groupBy()) && Objects.equals(nextPageToken(), other.nextPageToken()); } /** * 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. */ @Override public final String toString() { return ToString.builder("GetCostAndUsageRequest").add("TimePeriod", timePeriod()) .add("Granularity", granularityAsString()).add("Filter", filter()) .add("Metrics", hasMetrics() ? metrics() : null).add("GroupBy", hasGroupBy() ? groupBy() : null) .add("NextPageToken", nextPageToken()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "TimePeriod": return Optional.ofNullable(clazz.cast(timePeriod())); case "Granularity": return Optional.ofNullable(clazz.cast(granularityAsString())); case "Filter": return Optional.ofNullable(clazz.cast(filter())); case "Metrics": return Optional.ofNullable(clazz.cast(metrics())); case "GroupBy": return Optional.ofNullable(clazz.cast(groupBy())); case "NextPageToken": return Optional.ofNullable(clazz.cast(nextPageToken())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((GetCostAndUsageRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends CostExplorerRequest.Builder, SdkPojo, CopyableBuilder { /** *

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

* * @param 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 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. * @return Returns a reference to this object so that method calls can be chained together. */ Builder timePeriod(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 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. *

* This is a convenience method that creates an instance of the {@link DateInterval.Builder} avoiding the need * to create one manually via {@link DateInterval#builder()}. * *

* When the {@link Consumer} completes, {@link DateInterval.Builder#build()} is called immediately and its * result is passed to {@link #timePeriod(DateInterval)}. * * @param timePeriod * a consumer that will call methods on {@link DateInterval.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #timePeriod(DateInterval) */ default Builder timePeriod(Consumer timePeriod) { return timePeriod(DateInterval.builder().applyMutation(timePeriod).build()); } /** *

* Sets the Amazon Web Services cost granularity to MONTHLY or DAILY, or * HOURLY. If Granularity isn't set, the response object doesn't include the * Granularity, either MONTHLY or DAILY, or HOURLY. *

* * @param granularity * Sets the Amazon Web Services cost granularity to MONTHLY or DAILY, or * HOURLY. If Granularity isn't set, the response object doesn't include the * Granularity, either MONTHLY or DAILY, or HOURLY. * @see Granularity * @return Returns a reference to this object so that method calls can be chained together. * @see Granularity */ Builder granularity(String granularity); /** *

* Sets the Amazon Web Services cost granularity to MONTHLY or DAILY, or * HOURLY. If Granularity isn't set, the response object doesn't include the * Granularity, either MONTHLY or DAILY, or HOURLY. *

* * @param granularity * Sets the Amazon Web Services cost granularity to MONTHLY or DAILY, or * HOURLY. If Granularity isn't set, the response object doesn't include the * Granularity, either MONTHLY or DAILY, or HOURLY. * @see Granularity * @return Returns a reference to this object so that method calls can be chained together. * @see Granularity */ Builder granularity(Granularity granularity); /** *

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

*

* Valid values for MatchOptions for Dimensions are EQUALS and * CASE_SENSITIVE. *

*

* Valid values for MatchOptions for CostCategories and Tags are * EQUALS, ABSENT, and CASE_SENSITIVE. Default values are * EQUALS and CASE_SENSITIVE. *

* * @param 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.

*

* Valid values for MatchOptions for Dimensions are EQUALS and * CASE_SENSITIVE. *

*

* Valid values for MatchOptions for CostCategories and Tags are * EQUALS, ABSENT, and CASE_SENSITIVE. Default values are * EQUALS and CASE_SENSITIVE. * @return Returns a reference to this object so that method calls can be chained together. */ Builder filter(Expression 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. *

*

* Valid values for MatchOptions for Dimensions are EQUALS and * CASE_SENSITIVE. *

*

* Valid values for MatchOptions for CostCategories and Tags are * EQUALS, ABSENT, and CASE_SENSITIVE. Default values are * EQUALS and CASE_SENSITIVE. *

* This is a convenience method that creates an instance of the {@link Expression.Builder} avoiding the need to * create one manually via {@link Expression#builder()}. * *

* When the {@link Consumer} completes, {@link Expression.Builder#build()} is called immediately and its result * is passed to {@link #filter(Expression)}. * * @param filter * a consumer that will call methods on {@link Expression.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #filter(Expression) */ default Builder filter(Consumer filter) { return filter(Expression.builder().applyMutation(filter).build()); } /** *

* 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 * into account the units. 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 and GB). To get more meaningful UsageQuantity metrics, filter by * UsageType or UsageTypeGroups. *

*
*

* Metrics is required for GetCostAndUsage requests. *

* * @param 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 into account the units. 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 and GB). To get more meaningful * UsageQuantity metrics, filter by UsageType or UsageTypeGroups. *

*
*

* Metrics is required for GetCostAndUsage requests. * @return Returns a reference to this object so that method calls can be chained together. */ Builder metrics(Collection 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 * into account the units. 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 and GB). To get more meaningful UsageQuantity metrics, filter by * UsageType or UsageTypeGroups. *

*
*

* Metrics is required for GetCostAndUsage requests. *

* * @param 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 into account the units. 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 and GB). To get more meaningful * UsageQuantity metrics, filter by UsageType or UsageTypeGroups. *

*
*

* Metrics is required for GetCostAndUsage requests. * @return Returns a reference to this object so that method calls can be chained together. */ Builder metrics(String... metrics); /** *

* 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 DIMENSION type are AZ, INSTANCE_TYPE, * LEGAL_ENTITY_NAME, INVOICING_ENTITY, LINKED_ACCOUNT, * OPERATION, PLATFORM, PURCHASE_TYPE, SERVICE, * TENANCY, RECORD_TYPE, and USAGE_TYPE. *

*

* When you group by the TAG type and include a valid tag key, you get all tag values, including * empty strings. *

* * @param 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 DIMENSION type are AZ, INSTANCE_TYPE, * LEGAL_ENTITY_NAME, INVOICING_ENTITY, LINKED_ACCOUNT, * OPERATION, PLATFORM, PURCHASE_TYPE, SERVICE, * TENANCY, RECORD_TYPE, and USAGE_TYPE. *

*

* When you group by the TAG type and include a valid tag key, you get all tag values, * including empty strings. * @return Returns a reference to this object so that method calls can be chained together. */ Builder groupBy(Collection 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 DIMENSION type are AZ, INSTANCE_TYPE, * LEGAL_ENTITY_NAME, INVOICING_ENTITY, LINKED_ACCOUNT, * OPERATION, PLATFORM, PURCHASE_TYPE, SERVICE, * TENANCY, RECORD_TYPE, and USAGE_TYPE. *

*

* When you group by the TAG type and include a valid tag key, you get all tag values, including * empty strings. *

* * @param 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 DIMENSION type are AZ, INSTANCE_TYPE, * LEGAL_ENTITY_NAME, INVOICING_ENTITY, LINKED_ACCOUNT, * OPERATION, PLATFORM, PURCHASE_TYPE, SERVICE, * TENANCY, RECORD_TYPE, and USAGE_TYPE. *

*

* When you group by the TAG type and include a valid tag key, you get all tag values, * including empty strings. * @return Returns a reference to this object so that method calls can be chained together. */ Builder groupBy(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 DIMENSION type are AZ, INSTANCE_TYPE, * LEGAL_ENTITY_NAME, INVOICING_ENTITY, LINKED_ACCOUNT, * OPERATION, PLATFORM, PURCHASE_TYPE, SERVICE, * TENANCY, RECORD_TYPE, and USAGE_TYPE. *

*

* When you group by the TAG type and include a valid tag key, you get all tag values, including * empty strings. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.costexplorer.model.GroupDefinition.Builder} avoiding the need to * create one manually via {@link software.amazon.awssdk.services.costexplorer.model.GroupDefinition#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.costexplorer.model.GroupDefinition.Builder#build()} is called * immediately and its result is passed to {@link #groupBy(List)}. * * @param groupBy * a consumer that will call methods on * {@link software.amazon.awssdk.services.costexplorer.model.GroupDefinition.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #groupBy(java.util.Collection) */ Builder groupBy(Consumer... groupBy); /** *

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

* * @param 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. * @return Returns a reference to this object so that method calls can be chained together. */ Builder nextPageToken(String nextPageToken); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends CostExplorerRequest.BuilderImpl implements Builder { private DateInterval timePeriod; private String granularity; private Expression filter; private List metrics = DefaultSdkAutoConstructList.getInstance(); private List groupBy = DefaultSdkAutoConstructList.getInstance(); private String nextPageToken; private BuilderImpl() { } private BuilderImpl(GetCostAndUsageRequest model) { super(model); timePeriod(model.timePeriod); granularity(model.granularity); filter(model.filter); metrics(model.metrics); groupBy(model.groupBy); nextPageToken(model.nextPageToken); } public final DateInterval.Builder getTimePeriod() { return timePeriod != null ? timePeriod.toBuilder() : null; } public final void setTimePeriod(DateInterval.BuilderImpl timePeriod) { this.timePeriod = timePeriod != null ? timePeriod.build() : null; } @Override public final Builder timePeriod(DateInterval timePeriod) { this.timePeriod = timePeriod; return this; } public final String getGranularity() { return granularity; } public final void setGranularity(String granularity) { this.granularity = granularity; } @Override public final Builder granularity(String granularity) { this.granularity = granularity; return this; } @Override public final Builder granularity(Granularity granularity) { this.granularity(granularity == null ? null : granularity.toString()); return this; } public final Expression.Builder getFilter() { return filter != null ? filter.toBuilder() : null; } public final void setFilter(Expression.BuilderImpl filter) { this.filter = filter != null ? filter.build() : null; } @Override public final Builder filter(Expression filter) { this.filter = filter; return this; } public final Collection getMetrics() { if (metrics instanceof SdkAutoConstructList) { return null; } return metrics; } public final void setMetrics(Collection metrics) { this.metrics = MetricNamesCopier.copy(metrics); } @Override public final Builder metrics(Collection metrics) { this.metrics = MetricNamesCopier.copy(metrics); return this; } @Override @SafeVarargs public final Builder metrics(String... metrics) { metrics(Arrays.asList(metrics)); return this; } public final List getGroupBy() { List result = GroupDefinitionsCopier.copyToBuilder(this.groupBy); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setGroupBy(Collection groupBy) { this.groupBy = GroupDefinitionsCopier.copyFromBuilder(groupBy); } @Override public final Builder groupBy(Collection groupBy) { this.groupBy = GroupDefinitionsCopier.copy(groupBy); return this; } @Override @SafeVarargs public final Builder groupBy(GroupDefinition... groupBy) { groupBy(Arrays.asList(groupBy)); return this; } @Override @SafeVarargs public final Builder groupBy(Consumer... groupBy) { groupBy(Stream.of(groupBy).map(c -> GroupDefinition.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final String getNextPageToken() { return nextPageToken; } public final void setNextPageToken(String nextPageToken) { this.nextPageToken = nextPageToken; } @Override public final Builder nextPageToken(String nextPageToken) { this.nextPageToken = nextPageToken; return this; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public GetCostAndUsageRequest build() { return new GetCostAndUsageRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy