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

software.amazon.awssdk.services.costexplorer.model.GetSavingsPlansCoverageRequest 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.29.39
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 GetSavingsPlansCoverageRequest extends CostExplorerRequest implements
        ToCopyableBuilder {
    private static final SdkField TIME_PERIOD_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
            .memberName("TimePeriod").getter(getter(GetSavingsPlansCoverageRequest::timePeriod))
            .setter(setter(Builder::timePeriod)).constructor(DateInterval::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TimePeriod").build()).build();

    private static final SdkField> GROUP_BY_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("GroupBy")
            .getter(getter(GetSavingsPlansCoverageRequest::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 GRANULARITY_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("Granularity").getter(getter(GetSavingsPlansCoverageRequest::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(GetSavingsPlansCoverageRequest::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(GetSavingsPlansCoverageRequest::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 NEXT_TOKEN_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("NextToken").getter(getter(GetSavingsPlansCoverageRequest::nextToken)).setter(setter(Builder::nextToken))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NextToken").build()).build();

    private static final SdkField MAX_RESULTS_FIELD = SdkField. builder(MarshallingType.INTEGER)
            .memberName("MaxResults").getter(getter(GetSavingsPlansCoverageRequest::maxResults))
            .setter(setter(Builder::maxResults))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MaxResults").build()).build();

    private static final SdkField SORT_BY_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
            .memberName("SortBy").getter(getter(GetSavingsPlansCoverageRequest::sortBy)).setter(setter(Builder::sortBy))
            .constructor(SortDefinition::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SortBy").build()).build();

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

    private final DateInterval timePeriod;

    private final List groupBy;

    private final String granularity;

    private final Expression filter;

    private final List metrics;

    private final String nextToken;

    private final Integer maxResults;

    private final SortDefinition sortBy;

    private GetSavingsPlansCoverageRequest(BuilderImpl builder) {
        super(builder);
        this.timePeriod = builder.timePeriod;
        this.groupBy = builder.groupBy;
        this.granularity = builder.granularity;
        this.filter = builder.filter;
        this.metrics = builder.metrics;
        this.nextToken = builder.nextToken;
        this.maxResults = builder.maxResults;
        this.sortBy = builder.sortBy;
    }

    /**
     * 

* The time period that you want the usage and costs for. The Start date must be within 13 months. The * End date must be after the Start date, and before the current date. Future dates can't * be used as an End date. *

* * @return The time period that you want the usage and costs for. The Start date must be within 13 * months. The End date must be after the Start date, and before the current date. * Future dates can't be used as an End date. */ public final DateInterval timePeriod() { return timePeriod; } /** * Returns true if the GroupBy property was specified by the sender (it may be empty), or false if the sender did * not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service. */ public final boolean hasGroupBy() { return groupBy != null && !(groupBy instanceof SdkAutoConstructList); } /** *

* You can group the data using the attributes INSTANCE_FAMILY, REGION, or * SERVICE. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* You can use {@link #hasGroupBy()} to see if a value was sent in this field. *

* * @return You can group the data using the attributes INSTANCE_FAMILY, REGION, or * SERVICE. */ public final List groupBy() { return groupBy; } /** *

* The granularity of the Amazon Web Services cost data for your Savings Plans. Granularity can't be * set if GroupBy is set. *

*

* The GetSavingsPlansCoverage operation supports only DAILY and MONTHLY * granularities. *

*

* 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 The granularity of the Amazon Web Services cost data for your Savings Plans. Granularity * can't be set if GroupBy is set.

*

* The GetSavingsPlansCoverage operation supports only DAILY and * MONTHLY granularities. * @see Granularity */ public final Granularity granularity() { return Granularity.fromValue(granularity); } /** *

* The granularity of the Amazon Web Services cost data for your Savings Plans. Granularity can't be * set if GroupBy is set. *

*

* The GetSavingsPlansCoverage operation supports only DAILY and MONTHLY * granularities. *

*

* 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 The granularity of the Amazon Web Services cost data for your Savings Plans. Granularity * can't be set if GroupBy is set.

*

* The GetSavingsPlansCoverage operation supports only DAILY and * MONTHLY granularities. * @see Granularity */ public final String granularityAsString() { return granularity; } /** *

* Filters Savings Plans coverage data by dimensions. You can filter data for Savings Plans usage with the following * dimensions: *

*
    *
  • *

    * LINKED_ACCOUNT *

    *
  • *
  • *

    * REGION *

    *
  • *
  • *

    * SERVICE *

    *
  • *
  • *

    * INSTANCE_FAMILY *

    *
  • *
*

* GetSavingsPlansCoverage uses the same Expression * object as the other operations, but only AND is supported among each dimension. If there are * multiple values for a dimension, they are OR'd together. *

*

* Cost category is also supported. *

* * @return Filters Savings Plans coverage data by dimensions. You can filter data for Savings Plans usage with the * following dimensions:

*
    *
  • *

    * LINKED_ACCOUNT *

    *
  • *
  • *

    * REGION *

    *
  • *
  • *

    * SERVICE *

    *
  • *
  • *

    * INSTANCE_FAMILY *

    *
  • *
*

* GetSavingsPlansCoverage uses the same Expression object as the other operations, but only AND is supported among each * dimension. If there are multiple values for a dimension, they are OR'd together. *

*

* Cost category is also supported. */ public final Expression filter() { return filter; } /** * Returns true if the Metrics property was specified by the sender (it may be empty), or false if the sender did * not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service. */ public final boolean hasMetrics() { return metrics != null && !(metrics instanceof SdkAutoConstructList); } /** *

* The measurement that you want your Savings Plans coverage reported in. The only valid value is * SpendCoveredBySavingsPlans. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* You can use {@link #hasMetrics()} to see if a value was sent in this field. *

* * @return The measurement that you want your Savings Plans coverage reported in. The only valid value is * SpendCoveredBySavingsPlans. */ public final List metrics() { return metrics; } /** *

* 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 nextToken() { return nextToken; } /** *

* The number of items to be returned in a response. The default is 20, with a minimum value of * 1. *

* * @return The number of items to be returned in a response. The default is 20, with a minimum value of * 1. */ public final Integer maxResults() { return maxResults; } /** *

* The value by which you want to sort the data. *

*

* The following values are supported for Key: *

*
    *
  • *

    * SpendCoveredBySavingsPlan *

    *
  • *
  • *

    * OnDemandCost *

    *
  • *
  • *

    * CoveragePercentage *

    *
  • *
  • *

    * TotalCost *

    *
  • *
  • *

    * InstanceFamily *

    *
  • *
  • *

    * Region *

    *
  • *
  • *

    * Service *

    *
  • *
*

* Supported values for SortOrder are ASCENDING or DESCENDING. *

* * @return The value by which you want to sort the data.

*

* The following values are supported for Key: *

*
    *
  • *

    * SpendCoveredBySavingsPlan *

    *
  • *
  • *

    * OnDemandCost *

    *
  • *
  • *

    * CoveragePercentage *

    *
  • *
  • *

    * TotalCost *

    *
  • *
  • *

    * InstanceFamily *

    *
  • *
  • *

    * Region *

    *
  • *
  • *

    * Service *

    *
  • *
*

* Supported values for SortOrder are ASCENDING or DESCENDING. */ public final SortDefinition sortBy() { return sortBy; } @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(hasGroupBy() ? groupBy() : null); 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(nextToken()); hashCode = 31 * hashCode + Objects.hashCode(maxResults()); hashCode = 31 * hashCode + Objects.hashCode(sortBy()); 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 GetSavingsPlansCoverageRequest)) { return false; } GetSavingsPlansCoverageRequest other = (GetSavingsPlansCoverageRequest) obj; return Objects.equals(timePeriod(), other.timePeriod()) && hasGroupBy() == other.hasGroupBy() && Objects.equals(groupBy(), other.groupBy()) && Objects.equals(granularityAsString(), other.granularityAsString()) && Objects.equals(filter(), other.filter()) && hasMetrics() == other.hasMetrics() && Objects.equals(metrics(), other.metrics()) && Objects.equals(nextToken(), other.nextToken()) && Objects.equals(maxResults(), other.maxResults()) && Objects.equals(sortBy(), other.sortBy()); } /** * 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("GetSavingsPlansCoverageRequest").add("TimePeriod", timePeriod()) .add("GroupBy", hasGroupBy() ? groupBy() : null).add("Granularity", granularityAsString()) .add("Filter", filter()).add("Metrics", hasMetrics() ? metrics() : null).add("NextToken", nextToken()) .add("MaxResults", maxResults()).add("SortBy", sortBy()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "TimePeriod": return Optional.ofNullable(clazz.cast(timePeriod())); case "GroupBy": return Optional.ofNullable(clazz.cast(groupBy())); 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 "NextToken": return Optional.ofNullable(clazz.cast(nextToken())); case "MaxResults": return Optional.ofNullable(clazz.cast(maxResults())); case "SortBy": return Optional.ofNullable(clazz.cast(sortBy())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((GetSavingsPlansCoverageRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends CostExplorerRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The time period that you want the usage and costs for. The Start date must be within 13 months. * The End date must be after the Start date, and before the current date. Future * dates can't be used as an End date. *

* * @param timePeriod * The time period that you want the usage and costs for. The Start date must be within 13 * months. The End date must be after the Start date, and before the current * date. Future dates can't be used as an End date. * @return Returns a reference to this object so that method calls can be chained together. */ Builder timePeriod(DateInterval timePeriod); /** *

* The time period that you want the usage and costs for. The Start date must be within 13 months. * The End date must be after the Start date, and before the current date. Future * dates can't be used as an End date. *

* This is a convenience 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()); } /** *

* You can group the data using the attributes INSTANCE_FAMILY, REGION, or * SERVICE. *

* * @param groupBy * You can group the data using the attributes INSTANCE_FAMILY, REGION, or * SERVICE. * @return Returns a reference to this object so that method calls can be chained together. */ Builder groupBy(Collection groupBy); /** *

* You can group the data using the attributes INSTANCE_FAMILY, REGION, or * SERVICE. *

* * @param groupBy * You can group the data using the attributes INSTANCE_FAMILY, REGION, or * SERVICE. * @return Returns a reference to this object so that method calls can be chained together. */ Builder groupBy(GroupDefinition... groupBy); /** *

* You can group the data using the attributes INSTANCE_FAMILY, REGION, or * SERVICE. *

* This is a convenience that creates an instance of the {@link List.Builder} avoiding the need * to create one manually via {@link List#builder()}. * * When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and * its result is passed to {@link #groupBy(List)}. * * @param groupBy * a consumer that will call methods on {@link List.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #groupBy(List) */ Builder groupBy(Consumer... groupBy); /** *

* The granularity of the Amazon Web Services cost data for your Savings Plans. Granularity can't * be set if GroupBy is set. *

*

* The GetSavingsPlansCoverage operation supports only DAILY and MONTHLY * granularities. *

* * @param granularity * The granularity of the Amazon Web Services cost data for your Savings Plans. Granularity * can't be set if GroupBy is set.

*

* The GetSavingsPlansCoverage operation supports only DAILY and * MONTHLY granularities. * @see Granularity * @return Returns a reference to this object so that method calls can be chained together. * @see Granularity */ Builder granularity(String granularity); /** *

* The granularity of the Amazon Web Services cost data for your Savings Plans. Granularity can't * be set if GroupBy is set. *

*

* The GetSavingsPlansCoverage operation supports only DAILY and MONTHLY * granularities. *

* * @param granularity * The granularity of the Amazon Web Services cost data for your Savings Plans. Granularity * can't be set if GroupBy is set.

*

* The GetSavingsPlansCoverage operation supports only DAILY and * MONTHLY granularities. * @see Granularity * @return Returns a reference to this object so that method calls can be chained together. * @see Granularity */ Builder granularity(Granularity granularity); /** *

* Filters Savings Plans coverage data by dimensions. You can filter data for Savings Plans usage with the * following dimensions: *

*
    *
  • *

    * LINKED_ACCOUNT *

    *
  • *
  • *

    * REGION *

    *
  • *
  • *

    * SERVICE *

    *
  • *
  • *

    * INSTANCE_FAMILY *

    *
  • *
*

* GetSavingsPlansCoverage uses the same Expression * object as the other operations, but only AND is supported among each dimension. If there are * multiple values for a dimension, they are OR'd together. *

*

* Cost category is also supported. *

* * @param filter * Filters Savings Plans coverage data by dimensions. You can filter data for Savings Plans usage with * the following dimensions:

*
    *
  • *

    * LINKED_ACCOUNT *

    *
  • *
  • *

    * REGION *

    *
  • *
  • *

    * SERVICE *

    *
  • *
  • *

    * INSTANCE_FAMILY *

    *
  • *
*

* GetSavingsPlansCoverage uses the same Expression object as the other operations, but only AND is supported among each * dimension. If there are multiple values for a dimension, they are OR'd together. *

*

* Cost category is also supported. * @return Returns a reference to this object so that method calls can be chained together. */ Builder filter(Expression filter); /** *

* Filters Savings Plans coverage data by dimensions. You can filter data for Savings Plans usage with the * following dimensions: *

*
    *
  • *

    * LINKED_ACCOUNT *

    *
  • *
  • *

    * REGION *

    *
  • *
  • *

    * SERVICE *

    *
  • *
  • *

    * INSTANCE_FAMILY *

    *
  • *
*

* GetSavingsPlansCoverage uses the same Expression * object as the other operations, but only AND is supported among each dimension. If there are * multiple values for a dimension, they are OR'd together. *

*

* Cost category is also supported. *

* This is a convenience 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()); } /** *

* The measurement that you want your Savings Plans coverage reported in. The only valid value is * SpendCoveredBySavingsPlans. *

* * @param metrics * The measurement that you want your Savings Plans coverage reported in. The only valid value is * SpendCoveredBySavingsPlans. * @return Returns a reference to this object so that method calls can be chained together. */ Builder metrics(Collection metrics); /** *

* The measurement that you want your Savings Plans coverage reported in. The only valid value is * SpendCoveredBySavingsPlans. *

* * @param metrics * The measurement that you want your Savings Plans coverage reported in. The only valid value is * SpendCoveredBySavingsPlans. * @return Returns a reference to this object so that method calls can be chained together. */ Builder metrics(String... metrics); /** *

* 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 nextToken * 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 nextToken(String nextToken); /** *

* The number of items to be returned in a response. The default is 20, with a minimum value of * 1. *

* * @param maxResults * The number of items to be returned in a response. The default is 20, with a minimum value * of 1. * @return Returns a reference to this object so that method calls can be chained together. */ Builder maxResults(Integer maxResults); /** *

* The value by which you want to sort the data. *

*

* The following values are supported for Key: *

*
    *
  • *

    * SpendCoveredBySavingsPlan *

    *
  • *
  • *

    * OnDemandCost *

    *
  • *
  • *

    * CoveragePercentage *

    *
  • *
  • *

    * TotalCost *

    *
  • *
  • *

    * InstanceFamily *

    *
  • *
  • *

    * Region *

    *
  • *
  • *

    * Service *

    *
  • *
*

* Supported values for SortOrder are ASCENDING or DESCENDING. *

* * @param sortBy * The value by which you want to sort the data.

*

* The following values are supported for Key: *

*
    *
  • *

    * SpendCoveredBySavingsPlan *

    *
  • *
  • *

    * OnDemandCost *

    *
  • *
  • *

    * CoveragePercentage *

    *
  • *
  • *

    * TotalCost *

    *
  • *
  • *

    * InstanceFamily *

    *
  • *
  • *

    * Region *

    *
  • *
  • *

    * Service *

    *
  • *
*

* Supported values for SortOrder are ASCENDING or DESCENDING. * @return Returns a reference to this object so that method calls can be chained together. */ Builder sortBy(SortDefinition sortBy); /** *

* The value by which you want to sort the data. *

*

* The following values are supported for Key: *

*
    *
  • *

    * SpendCoveredBySavingsPlan *

    *
  • *
  • *

    * OnDemandCost *

    *
  • *
  • *

    * CoveragePercentage *

    *
  • *
  • *

    * TotalCost *

    *
  • *
  • *

    * InstanceFamily *

    *
  • *
  • *

    * Region *

    *
  • *
  • *

    * Service *

    *
  • *
*

* Supported values for SortOrder are ASCENDING or DESCENDING. *

* This is a convenience that creates an instance of the {@link SortDefinition.Builder} avoiding the need to * create one manually via {@link SortDefinition#builder()}. * * When the {@link Consumer} completes, {@link SortDefinition.Builder#build()} is called immediately and its * result is passed to {@link #sortBy(SortDefinition)}. * * @param sortBy * a consumer that will call methods on {@link SortDefinition.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #sortBy(SortDefinition) */ default Builder sortBy(Consumer sortBy) { return sortBy(SortDefinition.builder().applyMutation(sortBy).build()); } @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends CostExplorerRequest.BuilderImpl implements Builder { private DateInterval timePeriod; private List groupBy = DefaultSdkAutoConstructList.getInstance(); private String granularity; private Expression filter; private List metrics = DefaultSdkAutoConstructList.getInstance(); private String nextToken; private Integer maxResults; private SortDefinition sortBy; private BuilderImpl() { } private BuilderImpl(GetSavingsPlansCoverageRequest model) { super(model); timePeriod(model.timePeriod); groupBy(model.groupBy); granularity(model.granularity); filter(model.filter); metrics(model.metrics); nextToken(model.nextToken); maxResults(model.maxResults); sortBy(model.sortBy); } public final DateInterval.Builder getTimePeriod() { return timePeriod != null ? timePeriod.toBuilder() : null; } @Override public final Builder timePeriod(DateInterval timePeriod) { this.timePeriod = timePeriod; return this; } public final void setTimePeriod(DateInterval.BuilderImpl timePeriod) { this.timePeriod = timePeriod != null ? timePeriod.build() : null; } public final Collection getGroupBy() { if (groupBy instanceof SdkAutoConstructList) { return null; } return groupBy != null ? groupBy.stream().map(GroupDefinition::toBuilder).collect(Collectors.toList()) : null; } @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 void setGroupBy(Collection groupBy) { this.groupBy = GroupDefinitionsCopier.copyFromBuilder(groupBy); } public final String getGranularity() { return 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 void setGranularity(String granularity) { this.granularity = granularity; } public final Expression.Builder getFilter() { return filter != null ? filter.toBuilder() : null; } @Override public final Builder filter(Expression filter) { this.filter = filter; return this; } public final void setFilter(Expression.BuilderImpl filter) { this.filter = filter != null ? filter.build() : null; } public final Collection getMetrics() { if (metrics instanceof SdkAutoConstructList) { return null; } return 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 void setMetrics(Collection metrics) { this.metrics = MetricNamesCopier.copy(metrics); } public final String getNextToken() { return nextToken; } @Override public final Builder nextToken(String nextToken) { this.nextToken = nextToken; return this; } public final void setNextToken(String nextToken) { this.nextToken = nextToken; } public final Integer getMaxResults() { return maxResults; } @Override public final Builder maxResults(Integer maxResults) { this.maxResults = maxResults; return this; } public final void setMaxResults(Integer maxResults) { this.maxResults = maxResults; } public final SortDefinition.Builder getSortBy() { return sortBy != null ? sortBy.toBuilder() : null; } @Override public final Builder sortBy(SortDefinition sortBy) { this.sortBy = sortBy; return this; } public final void setSortBy(SortDefinition.BuilderImpl sortBy) { this.sortBy = sortBy != null ? sortBy.build() : null; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public GetSavingsPlansCoverageRequest build() { return new GetSavingsPlansCoverageRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy