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

software.amazon.awssdk.services.costexplorer.model.ReservationPurchaseRecommendation 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 2014-2019 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.io.Serializable;
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.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.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* A specific reservation that AWS recommends for purchase. *

*/ @Generated("software.amazon.awssdk:codegen") public final class ReservationPurchaseRecommendation implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField ACCOUNT_SCOPE_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(ReservationPurchaseRecommendation::accountScopeAsString)).setter(setter(Builder::accountScope)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AccountScope").build()).build(); private static final SdkField LOOKBACK_PERIOD_IN_DAYS_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(ReservationPurchaseRecommendation::lookbackPeriodInDaysAsString)) .setter(setter(Builder::lookbackPeriodInDays)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LookbackPeriodInDays").build()) .build(); private static final SdkField TERM_IN_YEARS_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(ReservationPurchaseRecommendation::termInYearsAsString)).setter(setter(Builder::termInYears)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TermInYears").build()).build(); private static final SdkField PAYMENT_OPTION_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(ReservationPurchaseRecommendation::paymentOptionAsString)).setter(setter(Builder::paymentOption)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PaymentOption").build()).build(); private static final SdkField SERVICE_SPECIFICATION_FIELD = SdkField . builder(MarshallingType.SDK_POJO) .getter(getter(ReservationPurchaseRecommendation::serviceSpecification)) .setter(setter(Builder::serviceSpecification)).constructor(ServiceSpecification::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ServiceSpecification").build()) .build(); private static final SdkField> RECOMMENDATION_DETAILS_FIELD = SdkField .> builder(MarshallingType.LIST) .getter(getter(ReservationPurchaseRecommendation::recommendationDetails)) .setter(setter(Builder::recommendationDetails)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RecommendationDetails").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(ReservationPurchaseRecommendationDetail::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField RECOMMENDATION_SUMMARY_FIELD = SdkField . builder(MarshallingType.SDK_POJO) .getter(getter(ReservationPurchaseRecommendation::recommendationSummary)) .setter(setter(Builder::recommendationSummary)).constructor(ReservationPurchaseRecommendationSummary::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RecommendationSummary").build()) .build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ACCOUNT_SCOPE_FIELD, LOOKBACK_PERIOD_IN_DAYS_FIELD, TERM_IN_YEARS_FIELD, PAYMENT_OPTION_FIELD, SERVICE_SPECIFICATION_FIELD, RECOMMENDATION_DETAILS_FIELD, RECOMMENDATION_SUMMARY_FIELD)); private static final long serialVersionUID = 1L; private final String accountScope; private final String lookbackPeriodInDays; private final String termInYears; private final String paymentOption; private final ServiceSpecification serviceSpecification; private final List recommendationDetails; private final ReservationPurchaseRecommendationSummary recommendationSummary; private ReservationPurchaseRecommendation(BuilderImpl builder) { this.accountScope = builder.accountScope; this.lookbackPeriodInDays = builder.lookbackPeriodInDays; this.termInYears = builder.termInYears; this.paymentOption = builder.paymentOption; this.serviceSpecification = builder.serviceSpecification; this.recommendationDetails = builder.recommendationDetails; this.recommendationSummary = builder.recommendationSummary; } /** *

* The account scope that AWS recommends that you purchase this instance for. For example, you can purchase this * reservation for an entire organization in AWS Organizations. *

*

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

* * @return The account scope that AWS recommends that you purchase this instance for. For example, you can purchase * this reservation for an entire organization in AWS Organizations. * @see AccountScope */ public AccountScope accountScope() { return AccountScope.fromValue(accountScope); } /** *

* The account scope that AWS recommends that you purchase this instance for. For example, you can purchase this * reservation for an entire organization in AWS Organizations. *

*

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

* * @return The account scope that AWS recommends that you purchase this instance for. For example, you can purchase * this reservation for an entire organization in AWS Organizations. * @see AccountScope */ public String accountScopeAsString() { return accountScope; } /** *

* How many days of previous usage that AWS considers when making this recommendation. *

*

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

* * @return How many days of previous usage that AWS considers when making this recommendation. * @see LookbackPeriodInDays */ public LookbackPeriodInDays lookbackPeriodInDays() { return LookbackPeriodInDays.fromValue(lookbackPeriodInDays); } /** *

* How many days of previous usage that AWS considers when making this recommendation. *

*

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

* * @return How many days of previous usage that AWS considers when making this recommendation. * @see LookbackPeriodInDays */ public String lookbackPeriodInDaysAsString() { return lookbackPeriodInDays; } /** *

* The term of the reservation that you want recommendations for, in years. *

*

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

* * @return The term of the reservation that you want recommendations for, in years. * @see TermInYears */ public TermInYears termInYears() { return TermInYears.fromValue(termInYears); } /** *

* The term of the reservation that you want recommendations for, in years. *

*

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

* * @return The term of the reservation that you want recommendations for, in years. * @see TermInYears */ public String termInYearsAsString() { return termInYears; } /** *

* The payment option for the reservation. For example, AllUpfront or NoUpfront. *

*

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

* * @return The payment option for the reservation. For example, AllUpfront or NoUpfront. * @see PaymentOption */ public PaymentOption paymentOption() { return PaymentOption.fromValue(paymentOption); } /** *

* The payment option for the reservation. For example, AllUpfront or NoUpfront. *

*

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

* * @return The payment option for the reservation. For example, AllUpfront or NoUpfront. * @see PaymentOption */ public String paymentOptionAsString() { return paymentOption; } /** *

* Hardware specifications for the service that you want recommendations for. *

* * @return Hardware specifications for the service that you want recommendations for. */ public ServiceSpecification serviceSpecification() { return serviceSpecification; } /** *

* Details about the recommended purchases. *

*

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

* * @return Details about the recommended purchases. */ public List recommendationDetails() { return recommendationDetails; } /** *

* A summary about the recommended purchase. *

* * @return A summary about the recommended purchase. */ public ReservationPurchaseRecommendationSummary recommendationSummary() { return recommendationSummary; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(accountScopeAsString()); hashCode = 31 * hashCode + Objects.hashCode(lookbackPeriodInDaysAsString()); hashCode = 31 * hashCode + Objects.hashCode(termInYearsAsString()); hashCode = 31 * hashCode + Objects.hashCode(paymentOptionAsString()); hashCode = 31 * hashCode + Objects.hashCode(serviceSpecification()); hashCode = 31 * hashCode + Objects.hashCode(recommendationDetails()); hashCode = 31 * hashCode + Objects.hashCode(recommendationSummary()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof ReservationPurchaseRecommendation)) { return false; } ReservationPurchaseRecommendation other = (ReservationPurchaseRecommendation) obj; return Objects.equals(accountScopeAsString(), other.accountScopeAsString()) && Objects.equals(lookbackPeriodInDaysAsString(), other.lookbackPeriodInDaysAsString()) && Objects.equals(termInYearsAsString(), other.termInYearsAsString()) && Objects.equals(paymentOptionAsString(), other.paymentOptionAsString()) && Objects.equals(serviceSpecification(), other.serviceSpecification()) && Objects.equals(recommendationDetails(), other.recommendationDetails()) && Objects.equals(recommendationSummary(), other.recommendationSummary()); } /** * 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 String toString() { return ToString.builder("ReservationPurchaseRecommendation").add("AccountScope", accountScopeAsString()) .add("LookbackPeriodInDays", lookbackPeriodInDaysAsString()).add("TermInYears", termInYearsAsString()) .add("PaymentOption", paymentOptionAsString()).add("ServiceSpecification", serviceSpecification()) .add("RecommendationDetails", recommendationDetails()).add("RecommendationSummary", recommendationSummary()) .build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "AccountScope": return Optional.ofNullable(clazz.cast(accountScopeAsString())); case "LookbackPeriodInDays": return Optional.ofNullable(clazz.cast(lookbackPeriodInDaysAsString())); case "TermInYears": return Optional.ofNullable(clazz.cast(termInYearsAsString())); case "PaymentOption": return Optional.ofNullable(clazz.cast(paymentOptionAsString())); case "ServiceSpecification": return Optional.ofNullable(clazz.cast(serviceSpecification())); case "RecommendationDetails": return Optional.ofNullable(clazz.cast(recommendationDetails())); case "RecommendationSummary": return Optional.ofNullable(clazz.cast(recommendationSummary())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((ReservationPurchaseRecommendation) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The account scope that AWS recommends that you purchase this instance for. For example, you can purchase this * reservation for an entire organization in AWS Organizations. *

* * @param accountScope * The account scope that AWS recommends that you purchase this instance for. For example, you can * purchase this reservation for an entire organization in AWS Organizations. * @see AccountScope * @return Returns a reference to this object so that method calls can be chained together. * @see AccountScope */ Builder accountScope(String accountScope); /** *

* The account scope that AWS recommends that you purchase this instance for. For example, you can purchase this * reservation for an entire organization in AWS Organizations. *

* * @param accountScope * The account scope that AWS recommends that you purchase this instance for. For example, you can * purchase this reservation for an entire organization in AWS Organizations. * @see AccountScope * @return Returns a reference to this object so that method calls can be chained together. * @see AccountScope */ Builder accountScope(AccountScope accountScope); /** *

* How many days of previous usage that AWS considers when making this recommendation. *

* * @param lookbackPeriodInDays * How many days of previous usage that AWS considers when making this recommendation. * @see LookbackPeriodInDays * @return Returns a reference to this object so that method calls can be chained together. * @see LookbackPeriodInDays */ Builder lookbackPeriodInDays(String lookbackPeriodInDays); /** *

* How many days of previous usage that AWS considers when making this recommendation. *

* * @param lookbackPeriodInDays * How many days of previous usage that AWS considers when making this recommendation. * @see LookbackPeriodInDays * @return Returns a reference to this object so that method calls can be chained together. * @see LookbackPeriodInDays */ Builder lookbackPeriodInDays(LookbackPeriodInDays lookbackPeriodInDays); /** *

* The term of the reservation that you want recommendations for, in years. *

* * @param termInYears * The term of the reservation that you want recommendations for, in years. * @see TermInYears * @return Returns a reference to this object so that method calls can be chained together. * @see TermInYears */ Builder termInYears(String termInYears); /** *

* The term of the reservation that you want recommendations for, in years. *

* * @param termInYears * The term of the reservation that you want recommendations for, in years. * @see TermInYears * @return Returns a reference to this object so that method calls can be chained together. * @see TermInYears */ Builder termInYears(TermInYears termInYears); /** *

* The payment option for the reservation. For example, AllUpfront or NoUpfront. *

* * @param paymentOption * The payment option for the reservation. For example, AllUpfront or NoUpfront * . * @see PaymentOption * @return Returns a reference to this object so that method calls can be chained together. * @see PaymentOption */ Builder paymentOption(String paymentOption); /** *

* The payment option for the reservation. For example, AllUpfront or NoUpfront. *

* * @param paymentOption * The payment option for the reservation. For example, AllUpfront or NoUpfront * . * @see PaymentOption * @return Returns a reference to this object so that method calls can be chained together. * @see PaymentOption */ Builder paymentOption(PaymentOption paymentOption); /** *

* Hardware specifications for the service that you want recommendations for. *

* * @param serviceSpecification * Hardware specifications for the service that you want recommendations for. * @return Returns a reference to this object so that method calls can be chained together. */ Builder serviceSpecification(ServiceSpecification serviceSpecification); /** *

* Hardware specifications for the service that you want recommendations for. *

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

* Details about the recommended purchases. *

* * @param recommendationDetails * Details about the recommended purchases. * @return Returns a reference to this object so that method calls can be chained together. */ Builder recommendationDetails(Collection recommendationDetails); /** *

* Details about the recommended purchases. *

* * @param recommendationDetails * Details about the recommended purchases. * @return Returns a reference to this object so that method calls can be chained together. */ Builder recommendationDetails(ReservationPurchaseRecommendationDetail... recommendationDetails); /** *

* Details about the recommended purchases. *

* 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 * #recommendationDetails(List)}. * * @param recommendationDetails * 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 #recommendationDetails(List) */ Builder recommendationDetails(Consumer... recommendationDetails); /** *

* A summary about the recommended purchase. *

* * @param recommendationSummary * A summary about the recommended purchase. * @return Returns a reference to this object so that method calls can be chained together. */ Builder recommendationSummary(ReservationPurchaseRecommendationSummary recommendationSummary); /** *

* A summary about the recommended purchase. *

* This is a convenience that creates an instance of the * {@link ReservationPurchaseRecommendationSummary.Builder} avoiding the need to create one manually via * {@link ReservationPurchaseRecommendationSummary#builder()}. * * When the {@link Consumer} completes, {@link ReservationPurchaseRecommendationSummary.Builder#build()} is * called immediately and its result is passed to * {@link #recommendationSummary(ReservationPurchaseRecommendationSummary)}. * * @param recommendationSummary * a consumer that will call methods on {@link ReservationPurchaseRecommendationSummary.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #recommendationSummary(ReservationPurchaseRecommendationSummary) */ default Builder recommendationSummary(Consumer recommendationSummary) { return recommendationSummary(ReservationPurchaseRecommendationSummary.builder().applyMutation(recommendationSummary) .build()); } } static final class BuilderImpl implements Builder { private String accountScope; private String lookbackPeriodInDays; private String termInYears; private String paymentOption; private ServiceSpecification serviceSpecification; private List recommendationDetails = DefaultSdkAutoConstructList.getInstance(); private ReservationPurchaseRecommendationSummary recommendationSummary; private BuilderImpl() { } private BuilderImpl(ReservationPurchaseRecommendation model) { accountScope(model.accountScope); lookbackPeriodInDays(model.lookbackPeriodInDays); termInYears(model.termInYears); paymentOption(model.paymentOption); serviceSpecification(model.serviceSpecification); recommendationDetails(model.recommendationDetails); recommendationSummary(model.recommendationSummary); } public final String getAccountScopeAsString() { return accountScope; } @Override public final Builder accountScope(String accountScope) { this.accountScope = accountScope; return this; } @Override public final Builder accountScope(AccountScope accountScope) { this.accountScope(accountScope.toString()); return this; } public final void setAccountScope(String accountScope) { this.accountScope = accountScope; } public final String getLookbackPeriodInDaysAsString() { return lookbackPeriodInDays; } @Override public final Builder lookbackPeriodInDays(String lookbackPeriodInDays) { this.lookbackPeriodInDays = lookbackPeriodInDays; return this; } @Override public final Builder lookbackPeriodInDays(LookbackPeriodInDays lookbackPeriodInDays) { this.lookbackPeriodInDays(lookbackPeriodInDays.toString()); return this; } public final void setLookbackPeriodInDays(String lookbackPeriodInDays) { this.lookbackPeriodInDays = lookbackPeriodInDays; } public final String getTermInYearsAsString() { return termInYears; } @Override public final Builder termInYears(String termInYears) { this.termInYears = termInYears; return this; } @Override public final Builder termInYears(TermInYears termInYears) { this.termInYears(termInYears.toString()); return this; } public final void setTermInYears(String termInYears) { this.termInYears = termInYears; } public final String getPaymentOptionAsString() { return paymentOption; } @Override public final Builder paymentOption(String paymentOption) { this.paymentOption = paymentOption; return this; } @Override public final Builder paymentOption(PaymentOption paymentOption) { this.paymentOption(paymentOption.toString()); return this; } public final void setPaymentOption(String paymentOption) { this.paymentOption = paymentOption; } public final ServiceSpecification.Builder getServiceSpecification() { return serviceSpecification != null ? serviceSpecification.toBuilder() : null; } @Override public final Builder serviceSpecification(ServiceSpecification serviceSpecification) { this.serviceSpecification = serviceSpecification; return this; } public final void setServiceSpecification(ServiceSpecification.BuilderImpl serviceSpecification) { this.serviceSpecification = serviceSpecification != null ? serviceSpecification.build() : null; } public final Collection getRecommendationDetails() { return recommendationDetails != null ? recommendationDetails.stream() .map(ReservationPurchaseRecommendationDetail::toBuilder).collect(Collectors.toList()) : null; } @Override public final Builder recommendationDetails(Collection recommendationDetails) { this.recommendationDetails = ReservationPurchaseRecommendationDetailsCopier.copy(recommendationDetails); return this; } @Override @SafeVarargs public final Builder recommendationDetails(ReservationPurchaseRecommendationDetail... recommendationDetails) { recommendationDetails(Arrays.asList(recommendationDetails)); return this; } @Override @SafeVarargs public final Builder recommendationDetails( Consumer... recommendationDetails) { recommendationDetails(Stream.of(recommendationDetails) .map(c -> ReservationPurchaseRecommendationDetail.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final void setRecommendationDetails( Collection recommendationDetails) { this.recommendationDetails = ReservationPurchaseRecommendationDetailsCopier.copyFromBuilder(recommendationDetails); } public final ReservationPurchaseRecommendationSummary.Builder getRecommendationSummary() { return recommendationSummary != null ? recommendationSummary.toBuilder() : null; } @Override public final Builder recommendationSummary(ReservationPurchaseRecommendationSummary recommendationSummary) { this.recommendationSummary = recommendationSummary; return this; } public final void setRecommendationSummary(ReservationPurchaseRecommendationSummary.BuilderImpl recommendationSummary) { this.recommendationSummary = recommendationSummary != null ? recommendationSummary.build() : null; } @Override public ReservationPurchaseRecommendation build() { return new ReservationPurchaseRecommendation(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy