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

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

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

    private static final SdkField> DATA_TYPE_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("DataType")
            .getter(getter(GetSavingsPlansUtilizationDetailsRequest::dataTypeAsStrings))
            .setter(setter(Builder::dataTypeWithStrings))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DataType").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(GetSavingsPlansUtilizationDetailsRequest::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(GetSavingsPlansUtilizationDetailsRequest::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(GetSavingsPlansUtilizationDetailsRequest::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,
            FILTER_FIELD, DATA_TYPE_FIELD, NEXT_TOKEN_FIELD, MAX_RESULTS_FIELD, SORT_BY_FIELD));

    private final DateInterval timePeriod;

    private final Expression filter;

    private final List dataType;

    private final String nextToken;

    private final Integer maxResults;

    private final SortDefinition sortBy;

    private GetSavingsPlansUtilizationDetailsRequest(BuilderImpl builder) {
        super(builder);
        this.timePeriod = builder.timePeriod;
        this.filter = builder.filter;
        this.dataType = builder.dataType;
        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; } /** *

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

*
    *
  • *

    * LINKED_ACCOUNT *

    *
  • *
  • *

    * SAVINGS_PLAN_ARN *

    *
  • *
  • *

    * REGION *

    *
  • *
  • *

    * PAYMENT_OPTION *

    *
  • *
  • *

    * INSTANCE_TYPE_FAMILY *

    *
  • *
*

* GetSavingsPlansUtilizationDetails uses the same Expression * object as the other operations, but only AND is supported among each dimension. *

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

*
    *
  • *

    * LINKED_ACCOUNT *

    *
  • *
  • *

    * SAVINGS_PLAN_ARN *

    *
  • *
  • *

    * REGION *

    *
  • *
  • *

    * PAYMENT_OPTION *

    *
  • *
  • *

    * INSTANCE_TYPE_FAMILY *

    *
  • *
*

* GetSavingsPlansUtilizationDetails uses the same Expression object as the other operations, but only AND is supported among each * dimension. */ public final Expression filter() { return filter; } /** *

* The data type. *

*

* 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 #hasDataType} method. *

* * @return The data type. */ public final List dataType() { return SavingsPlansDataTypesCopier.copyStringToEnum(dataType); } /** * For responses, this returns true if the service returned a value for the DataType 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 hasDataType() { return dataType != null && !(dataType instanceof SdkAutoConstructList); } /** *

* The data type. *

*

* 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 #hasDataType} method. *

* * @return The data type. */ public final List dataTypeAsStrings() { return dataType; } /** *

* 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 that you want to sort the data by. *

*

* The following values are supported for Key: *

*
    *
  • *

    * UtilizationPercentage *

    *
  • *
  • *

    * TotalCommitment *

    *
  • *
  • *

    * UsedCommitment *

    *
  • *
  • *

    * UnusedCommitment *

    *
  • *
  • *

    * NetSavings *

    *
  • *
  • *

    * AmortizedRecurringCommitment *

    *
  • *
  • *

    * AmortizedUpfrontCommitment *

    *
  • *
*

* The supported values for SortOrder are ASCENDING and DESCENDING. *

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

*

* The following values are supported for Key: *

*
    *
  • *

    * UtilizationPercentage *

    *
  • *
  • *

    * TotalCommitment *

    *
  • *
  • *

    * UsedCommitment *

    *
  • *
  • *

    * UnusedCommitment *

    *
  • *
  • *

    * NetSavings *

    *
  • *
  • *

    * AmortizedRecurringCommitment *

    *
  • *
  • *

    * AmortizedUpfrontCommitment *

    *
  • *
*

* The supported values for SortOrder are ASCENDING and 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(filter()); hashCode = 31 * hashCode + Objects.hashCode(hasDataType() ? dataTypeAsStrings() : 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 GetSavingsPlansUtilizationDetailsRequest)) { return false; } GetSavingsPlansUtilizationDetailsRequest other = (GetSavingsPlansUtilizationDetailsRequest) obj; return Objects.equals(timePeriod(), other.timePeriod()) && Objects.equals(filter(), other.filter()) && hasDataType() == other.hasDataType() && Objects.equals(dataTypeAsStrings(), other.dataTypeAsStrings()) && 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("GetSavingsPlansUtilizationDetailsRequest").add("TimePeriod", timePeriod()) .add("Filter", filter()).add("DataType", hasDataType() ? dataTypeAsStrings() : 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 "Filter": return Optional.ofNullable(clazz.cast(filter())); case "DataType": return Optional.ofNullable(clazz.cast(dataTypeAsStrings())); 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((GetSavingsPlansUtilizationDetailsRequest) 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 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()); } /** *

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

*
    *
  • *

    * LINKED_ACCOUNT *

    *
  • *
  • *

    * SAVINGS_PLAN_ARN *

    *
  • *
  • *

    * REGION *

    *
  • *
  • *

    * PAYMENT_OPTION *

    *
  • *
  • *

    * INSTANCE_TYPE_FAMILY *

    *
  • *
*

* GetSavingsPlansUtilizationDetails uses the same Expression * object as the other operations, but only AND is supported among each dimension. *

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

*
    *
  • *

    * LINKED_ACCOUNT *

    *
  • *
  • *

    * SAVINGS_PLAN_ARN *

    *
  • *
  • *

    * REGION *

    *
  • *
  • *

    * PAYMENT_OPTION *

    *
  • *
  • *

    * INSTANCE_TYPE_FAMILY *

    *
  • *
*

* GetSavingsPlansUtilizationDetails uses the same Expression object as the other operations, but only AND is supported among each * dimension. * @return Returns a reference to this object so that method calls can be chained together. */ Builder filter(Expression filter); /** *

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

*
    *
  • *

    * LINKED_ACCOUNT *

    *
  • *
  • *

    * SAVINGS_PLAN_ARN *

    *
  • *
  • *

    * REGION *

    *
  • *
  • *

    * PAYMENT_OPTION *

    *
  • *
  • *

    * INSTANCE_TYPE_FAMILY *

    *
  • *
*

* GetSavingsPlansUtilizationDetails uses the same Expression * object as the other operations, but only AND is supported among each dimension. *

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

* The data type. *

* * @param dataType * The data type. * @return Returns a reference to this object so that method calls can be chained together. */ Builder dataTypeWithStrings(Collection dataType); /** *

* The data type. *

* * @param dataType * The data type. * @return Returns a reference to this object so that method calls can be chained together. */ Builder dataTypeWithStrings(String... dataType); /** *

* The data type. *

* * @param dataType * The data type. * @return Returns a reference to this object so that method calls can be chained together. */ Builder dataType(Collection dataType); /** *

* The data type. *

* * @param dataType * The data type. * @return Returns a reference to this object so that method calls can be chained together. */ Builder dataType(SavingsPlansDataType... dataType); /** *

* 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 that you want to sort the data by. *

*

* The following values are supported for Key: *

*
    *
  • *

    * UtilizationPercentage *

    *
  • *
  • *

    * TotalCommitment *

    *
  • *
  • *

    * UsedCommitment *

    *
  • *
  • *

    * UnusedCommitment *

    *
  • *
  • *

    * NetSavings *

    *
  • *
  • *

    * AmortizedRecurringCommitment *

    *
  • *
  • *

    * AmortizedUpfrontCommitment *

    *
  • *
*

* The supported values for SortOrder are ASCENDING and DESCENDING. *

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

*

* The following values are supported for Key: *

*
    *
  • *

    * UtilizationPercentage *

    *
  • *
  • *

    * TotalCommitment *

    *
  • *
  • *

    * UsedCommitment *

    *
  • *
  • *

    * UnusedCommitment *

    *
  • *
  • *

    * NetSavings *

    *
  • *
  • *

    * AmortizedRecurringCommitment *

    *
  • *
  • *

    * AmortizedUpfrontCommitment *

    *
  • *
*

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

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

*

* The following values are supported for Key: *

*
    *
  • *

    * UtilizationPercentage *

    *
  • *
  • *

    * TotalCommitment *

    *
  • *
  • *

    * UsedCommitment *

    *
  • *
  • *

    * UnusedCommitment *

    *
  • *
  • *

    * NetSavings *

    *
  • *
  • *

    * AmortizedRecurringCommitment *

    *
  • *
  • *

    * AmortizedUpfrontCommitment *

    *
  • *
*

* The supported values for SortOrder are ASCENDING and DESCENDING. *

* This is a convenience method 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 Expression filter; private List dataType = DefaultSdkAutoConstructList.getInstance(); private String nextToken; private Integer maxResults; private SortDefinition sortBy; private BuilderImpl() { } private BuilderImpl(GetSavingsPlansUtilizationDetailsRequest model) { super(model); timePeriod(model.timePeriod); filter(model.filter); dataTypeWithStrings(model.dataType); nextToken(model.nextToken); maxResults(model.maxResults); sortBy(model.sortBy); } 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 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 getDataType() { if (dataType instanceof SdkAutoConstructList) { return null; } return dataType; } public final void setDataType(Collection dataType) { this.dataType = SavingsPlansDataTypesCopier.copy(dataType); } @Override public final Builder dataTypeWithStrings(Collection dataType) { this.dataType = SavingsPlansDataTypesCopier.copy(dataType); return this; } @Override @SafeVarargs public final Builder dataTypeWithStrings(String... dataType) { dataTypeWithStrings(Arrays.asList(dataType)); return this; } @Override public final Builder dataType(Collection dataType) { this.dataType = SavingsPlansDataTypesCopier.copyEnumToString(dataType); return this; } @Override @SafeVarargs public final Builder dataType(SavingsPlansDataType... dataType) { dataType(Arrays.asList(dataType)); return this; } public final String getNextToken() { return nextToken; } public final void setNextToken(String nextToken) { this.nextToken = nextToken; } @Override public final Builder nextToken(String nextToken) { this.nextToken = nextToken; return this; } public final Integer getMaxResults() { return maxResults; } public final void setMaxResults(Integer maxResults) { this.maxResults = maxResults; } @Override public final Builder maxResults(Integer maxResults) { this.maxResults = maxResults; return this; } public final SortDefinition.Builder getSortBy() { return sortBy != null ? sortBy.toBuilder() : null; } public final void setSortBy(SortDefinition.BuilderImpl sortBy) { this.sortBy = sortBy != null ? sortBy.build() : null; } @Override public final Builder sortBy(SortDefinition sortBy) { this.sortBy = sortBy; 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 GetSavingsPlansUtilizationDetailsRequest build() { return new GetSavingsPlansUtilizationDetailsRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy