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

software.amazon.awssdk.services.costexplorer.model.RightsizingRecommendation 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.io.Serializable;
import java.util.Arrays;
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.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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Recommendations to rightsize resources. *

*/ @Generated("software.amazon.awssdk:codegen") public final class RightsizingRecommendation implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField ACCOUNT_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("AccountId").getter(getter(RightsizingRecommendation::accountId)).setter(setter(Builder::accountId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AccountId").build()).build(); private static final SdkField CURRENT_INSTANCE_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("CurrentInstance") .getter(getter(RightsizingRecommendation::currentInstance)).setter(setter(Builder::currentInstance)) .constructor(CurrentInstance::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CurrentInstance").build()).build(); private static final SdkField RIGHTSIZING_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("RightsizingType").getter(getter(RightsizingRecommendation::rightsizingTypeAsString)) .setter(setter(Builder::rightsizingType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RightsizingType").build()).build(); private static final SdkField MODIFY_RECOMMENDATION_DETAIL_FIELD = SdkField . builder(MarshallingType.SDK_POJO) .memberName("ModifyRecommendationDetail") .getter(getter(RightsizingRecommendation::modifyRecommendationDetail)) .setter(setter(Builder::modifyRecommendationDetail)) .constructor(ModifyRecommendationDetail::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ModifyRecommendationDetail").build()) .build(); private static final SdkField TERMINATE_RECOMMENDATION_DETAIL_FIELD = SdkField . builder(MarshallingType.SDK_POJO) .memberName("TerminateRecommendationDetail") .getter(getter(RightsizingRecommendation::terminateRecommendationDetail)) .setter(setter(Builder::terminateRecommendationDetail)) .constructor(TerminateRecommendationDetail::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TerminateRecommendationDetail") .build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ACCOUNT_ID_FIELD, CURRENT_INSTANCE_FIELD, RIGHTSIZING_TYPE_FIELD, MODIFY_RECOMMENDATION_DETAIL_FIELD, TERMINATE_RECOMMENDATION_DETAIL_FIELD)); private static final long serialVersionUID = 1L; private final String accountId; private final CurrentInstance currentInstance; private final String rightsizingType; private final ModifyRecommendationDetail modifyRecommendationDetail; private final TerminateRecommendationDetail terminateRecommendationDetail; private RightsizingRecommendation(BuilderImpl builder) { this.accountId = builder.accountId; this.currentInstance = builder.currentInstance; this.rightsizingType = builder.rightsizingType; this.modifyRecommendationDetail = builder.modifyRecommendationDetail; this.terminateRecommendationDetail = builder.terminateRecommendationDetail; } /** *

* The account that this recommendation is for. *

* * @return The account that this recommendation is for. */ public final String accountId() { return accountId; } /** *

* Context regarding the current instance. *

* * @return Context regarding the current instance. */ public final CurrentInstance currentInstance() { return currentInstance; } /** *

* Recommendation to either terminate or modify the resource. *

*

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

* * @return Recommendation to either terminate or modify the resource. * @see RightsizingType */ public final RightsizingType rightsizingType() { return RightsizingType.fromValue(rightsizingType); } /** *

* Recommendation to either terminate or modify the resource. *

*

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

* * @return Recommendation to either terminate or modify the resource. * @see RightsizingType */ public final String rightsizingTypeAsString() { return rightsizingType; } /** *

* Details for modification recommendations. *

* * @return Details for modification recommendations. */ public final ModifyRecommendationDetail modifyRecommendationDetail() { return modifyRecommendationDetail; } /** *

* Details for termination recommendations. *

* * @return Details for termination recommendations. */ public final TerminateRecommendationDetail terminateRecommendationDetail() { return terminateRecommendationDetail; } @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 + Objects.hashCode(accountId()); hashCode = 31 * hashCode + Objects.hashCode(currentInstance()); hashCode = 31 * hashCode + Objects.hashCode(rightsizingTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(modifyRecommendationDetail()); hashCode = 31 * hashCode + Objects.hashCode(terminateRecommendationDetail()); return hashCode; } @Override public final boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof RightsizingRecommendation)) { return false; } RightsizingRecommendation other = (RightsizingRecommendation) obj; return Objects.equals(accountId(), other.accountId()) && Objects.equals(currentInstance(), other.currentInstance()) && Objects.equals(rightsizingTypeAsString(), other.rightsizingTypeAsString()) && Objects.equals(modifyRecommendationDetail(), other.modifyRecommendationDetail()) && Objects.equals(terminateRecommendationDetail(), other.terminateRecommendationDetail()); } /** * 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("RightsizingRecommendation").add("AccountId", accountId()) .add("CurrentInstance", currentInstance()).add("RightsizingType", rightsizingTypeAsString()) .add("ModifyRecommendationDetail", modifyRecommendationDetail()) .add("TerminateRecommendationDetail", terminateRecommendationDetail()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "AccountId": return Optional.ofNullable(clazz.cast(accountId())); case "CurrentInstance": return Optional.ofNullable(clazz.cast(currentInstance())); case "RightsizingType": return Optional.ofNullable(clazz.cast(rightsizingTypeAsString())); case "ModifyRecommendationDetail": return Optional.ofNullable(clazz.cast(modifyRecommendationDetail())); case "TerminateRecommendationDetail": return Optional.ofNullable(clazz.cast(terminateRecommendationDetail())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((RightsizingRecommendation) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The account that this recommendation is for. *

* * @param accountId * The account that this recommendation is for. * @return Returns a reference to this object so that method calls can be chained together. */ Builder accountId(String accountId); /** *

* Context regarding the current instance. *

* * @param currentInstance * Context regarding the current instance. * @return Returns a reference to this object so that method calls can be chained together. */ Builder currentInstance(CurrentInstance currentInstance); /** *

* Context regarding the current instance. *

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

* Recommendation to either terminate or modify the resource. *

* * @param rightsizingType * Recommendation to either terminate or modify the resource. * @see RightsizingType * @return Returns a reference to this object so that method calls can be chained together. * @see RightsizingType */ Builder rightsizingType(String rightsizingType); /** *

* Recommendation to either terminate or modify the resource. *

* * @param rightsizingType * Recommendation to either terminate or modify the resource. * @see RightsizingType * @return Returns a reference to this object so that method calls can be chained together. * @see RightsizingType */ Builder rightsizingType(RightsizingType rightsizingType); /** *

* Details for modification recommendations. *

* * @param modifyRecommendationDetail * Details for modification recommendations. * @return Returns a reference to this object so that method calls can be chained together. */ Builder modifyRecommendationDetail(ModifyRecommendationDetail modifyRecommendationDetail); /** *

* Details for modification recommendations. *

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

* Details for termination recommendations. *

* * @param terminateRecommendationDetail * Details for termination recommendations. * @return Returns a reference to this object so that method calls can be chained together. */ Builder terminateRecommendationDetail(TerminateRecommendationDetail terminateRecommendationDetail); /** *

* Details for termination recommendations. *

* This is a convenience that creates an instance of the {@link TerminateRecommendationDetail.Builder} avoiding * the need to create one manually via {@link TerminateRecommendationDetail#builder()}. * * When the {@link Consumer} completes, {@link TerminateRecommendationDetail.Builder#build()} is called * immediately and its result is passed to {@link #terminateRecommendationDetail(TerminateRecommendationDetail)} * . * * @param terminateRecommendationDetail * a consumer that will call methods on {@link TerminateRecommendationDetail.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #terminateRecommendationDetail(TerminateRecommendationDetail) */ default Builder terminateRecommendationDetail( Consumer terminateRecommendationDetail) { return terminateRecommendationDetail(TerminateRecommendationDetail.builder() .applyMutation(terminateRecommendationDetail).build()); } } static final class BuilderImpl implements Builder { private String accountId; private CurrentInstance currentInstance; private String rightsizingType; private ModifyRecommendationDetail modifyRecommendationDetail; private TerminateRecommendationDetail terminateRecommendationDetail; private BuilderImpl() { } private BuilderImpl(RightsizingRecommendation model) { accountId(model.accountId); currentInstance(model.currentInstance); rightsizingType(model.rightsizingType); modifyRecommendationDetail(model.modifyRecommendationDetail); terminateRecommendationDetail(model.terminateRecommendationDetail); } public final String getAccountId() { return accountId; } @Override public final Builder accountId(String accountId) { this.accountId = accountId; return this; } public final void setAccountId(String accountId) { this.accountId = accountId; } public final CurrentInstance.Builder getCurrentInstance() { return currentInstance != null ? currentInstance.toBuilder() : null; } @Override public final Builder currentInstance(CurrentInstance currentInstance) { this.currentInstance = currentInstance; return this; } public final void setCurrentInstance(CurrentInstance.BuilderImpl currentInstance) { this.currentInstance = currentInstance != null ? currentInstance.build() : null; } public final String getRightsizingType() { return rightsizingType; } @Override public final Builder rightsizingType(String rightsizingType) { this.rightsizingType = rightsizingType; return this; } @Override public final Builder rightsizingType(RightsizingType rightsizingType) { this.rightsizingType(rightsizingType == null ? null : rightsizingType.toString()); return this; } public final void setRightsizingType(String rightsizingType) { this.rightsizingType = rightsizingType; } public final ModifyRecommendationDetail.Builder getModifyRecommendationDetail() { return modifyRecommendationDetail != null ? modifyRecommendationDetail.toBuilder() : null; } @Override public final Builder modifyRecommendationDetail(ModifyRecommendationDetail modifyRecommendationDetail) { this.modifyRecommendationDetail = modifyRecommendationDetail; return this; } public final void setModifyRecommendationDetail(ModifyRecommendationDetail.BuilderImpl modifyRecommendationDetail) { this.modifyRecommendationDetail = modifyRecommendationDetail != null ? modifyRecommendationDetail.build() : null; } public final TerminateRecommendationDetail.Builder getTerminateRecommendationDetail() { return terminateRecommendationDetail != null ? terminateRecommendationDetail.toBuilder() : null; } @Override public final Builder terminateRecommendationDetail(TerminateRecommendationDetail terminateRecommendationDetail) { this.terminateRecommendationDetail = terminateRecommendationDetail; return this; } public final void setTerminateRecommendationDetail(TerminateRecommendationDetail.BuilderImpl terminateRecommendationDetail) { this.terminateRecommendationDetail = terminateRecommendationDetail != null ? terminateRecommendationDetail.build() : null; } @Override public RightsizingRecommendation build() { return new RightsizingRecommendation(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy