software.amazon.awssdk.services.costoptimizationhub.model.Ec2ReservedInstancesConfiguration Maven / Gradle / Ivy
Show all versions of costoptimizationhub Show documentation
/*
* 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.costoptimizationhub.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.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;
/**
*
* The EC2 reserved instances configuration used for recommendations.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Ec2ReservedInstancesConfiguration implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ACCOUNT_SCOPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("accountScope").getter(getter(Ec2ReservedInstancesConfiguration::accountScope))
.setter(setter(Builder::accountScope))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("accountScope").build()).build();
private static final SdkField SERVICE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("service")
.getter(getter(Ec2ReservedInstancesConfiguration::service)).setter(setter(Builder::service))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("service").build()).build();
private static final SdkField NORMALIZED_UNITS_TO_PURCHASE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("normalizedUnitsToPurchase").getter(getter(Ec2ReservedInstancesConfiguration::normalizedUnitsToPurchase))
.setter(setter(Builder::normalizedUnitsToPurchase))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("normalizedUnitsToPurchase").build())
.build();
private static final SdkField TERM_FIELD = SdkField. builder(MarshallingType.STRING).memberName("term")
.getter(getter(Ec2ReservedInstancesConfiguration::term)).setter(setter(Builder::term))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("term").build()).build();
private static final SdkField PAYMENT_OPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("paymentOption").getter(getter(Ec2ReservedInstancesConfiguration::paymentOption))
.setter(setter(Builder::paymentOption))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("paymentOption").build()).build();
private static final SdkField NUMBER_OF_INSTANCES_TO_PURCHASE_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("numberOfInstancesToPurchase")
.getter(getter(Ec2ReservedInstancesConfiguration::numberOfInstancesToPurchase))
.setter(setter(Builder::numberOfInstancesToPurchase))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("numberOfInstancesToPurchase")
.build()).build();
private static final SdkField OFFERING_CLASS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("offeringClass").getter(getter(Ec2ReservedInstancesConfiguration::offeringClass))
.setter(setter(Builder::offeringClass))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("offeringClass").build()).build();
private static final SdkField INSTANCE_FAMILY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("instanceFamily").getter(getter(Ec2ReservedInstancesConfiguration::instanceFamily))
.setter(setter(Builder::instanceFamily))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("instanceFamily").build()).build();
private static final SdkField INSTANCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("instanceType").getter(getter(Ec2ReservedInstancesConfiguration::instanceType))
.setter(setter(Builder::instanceType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("instanceType").build()).build();
private static final SdkField RESERVED_INSTANCES_REGION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("reservedInstancesRegion").getter(getter(Ec2ReservedInstancesConfiguration::reservedInstancesRegion))
.setter(setter(Builder::reservedInstancesRegion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("reservedInstancesRegion").build())
.build();
private static final SdkField CURRENT_GENERATION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("currentGeneration").getter(getter(Ec2ReservedInstancesConfiguration::currentGeneration))
.setter(setter(Builder::currentGeneration))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("currentGeneration").build()).build();
private static final SdkField PLATFORM_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("platform").getter(getter(Ec2ReservedInstancesConfiguration::platform)).setter(setter(Builder::platform))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("platform").build()).build();
private static final SdkField TENANCY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("tenancy")
.getter(getter(Ec2ReservedInstancesConfiguration::tenancy)).setter(setter(Builder::tenancy))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("tenancy").build()).build();
private static final SdkField SIZE_FLEX_ELIGIBLE_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("sizeFlexEligible").getter(getter(Ec2ReservedInstancesConfiguration::sizeFlexEligible))
.setter(setter(Builder::sizeFlexEligible))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("sizeFlexEligible").build()).build();
private static final SdkField UPFRONT_COST_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("upfrontCost").getter(getter(Ec2ReservedInstancesConfiguration::upfrontCost))
.setter(setter(Builder::upfrontCost))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("upfrontCost").build()).build();
private static final SdkField MONTHLY_RECURRING_COST_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("monthlyRecurringCost").getter(getter(Ec2ReservedInstancesConfiguration::monthlyRecurringCost))
.setter(setter(Builder::monthlyRecurringCost))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("monthlyRecurringCost").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ACCOUNT_SCOPE_FIELD,
SERVICE_FIELD, NORMALIZED_UNITS_TO_PURCHASE_FIELD, TERM_FIELD, PAYMENT_OPTION_FIELD,
NUMBER_OF_INSTANCES_TO_PURCHASE_FIELD, OFFERING_CLASS_FIELD, INSTANCE_FAMILY_FIELD, INSTANCE_TYPE_FIELD,
RESERVED_INSTANCES_REGION_FIELD, CURRENT_GENERATION_FIELD, PLATFORM_FIELD, TENANCY_FIELD, SIZE_FLEX_ELIGIBLE_FIELD,
UPFRONT_COST_FIELD, MONTHLY_RECURRING_COST_FIELD));
private static final long serialVersionUID = 1L;
private final String accountScope;
private final String service;
private final String normalizedUnitsToPurchase;
private final String term;
private final String paymentOption;
private final String numberOfInstancesToPurchase;
private final String offeringClass;
private final String instanceFamily;
private final String instanceType;
private final String reservedInstancesRegion;
private final String currentGeneration;
private final String platform;
private final String tenancy;
private final Boolean sizeFlexEligible;
private final String upfrontCost;
private final String monthlyRecurringCost;
private Ec2ReservedInstancesConfiguration(BuilderImpl builder) {
this.accountScope = builder.accountScope;
this.service = builder.service;
this.normalizedUnitsToPurchase = builder.normalizedUnitsToPurchase;
this.term = builder.term;
this.paymentOption = builder.paymentOption;
this.numberOfInstancesToPurchase = builder.numberOfInstancesToPurchase;
this.offeringClass = builder.offeringClass;
this.instanceFamily = builder.instanceFamily;
this.instanceType = builder.instanceType;
this.reservedInstancesRegion = builder.reservedInstancesRegion;
this.currentGeneration = builder.currentGeneration;
this.platform = builder.platform;
this.tenancy = builder.tenancy;
this.sizeFlexEligible = builder.sizeFlexEligible;
this.upfrontCost = builder.upfrontCost;
this.monthlyRecurringCost = builder.monthlyRecurringCost;
}
/**
*
* The account scope that you want your recommendations for.
*
*
* @return The account scope that you want your recommendations for.
*/
public final String accountScope() {
return accountScope;
}
/**
*
* The service that you want your recommendations for.
*
*
* @return The service that you want your recommendations for.
*/
public final String service() {
return service;
}
/**
*
* The number of normalized units that Amazon Web Services recommends that you purchase.
*
*
* @return The number of normalized units that Amazon Web Services recommends that you purchase.
*/
public final String normalizedUnitsToPurchase() {
return normalizedUnitsToPurchase;
}
/**
*
* The reserved instances recommendation term in years.
*
*
* @return The reserved instances recommendation term in years.
*/
public final String term() {
return term;
}
/**
*
* The payment option for the commitment.
*
*
* @return The payment option for the commitment.
*/
public final String paymentOption() {
return paymentOption;
}
/**
*
* The number of instances that Amazon Web Services recommends that you purchase.
*
*
* @return The number of instances that Amazon Web Services recommends that you purchase.
*/
public final String numberOfInstancesToPurchase() {
return numberOfInstancesToPurchase;
}
/**
*
* Indicates whether the recommendation is for standard or convertible reservations.
*
*
* @return Indicates whether the recommendation is for standard or convertible reservations.
*/
public final String offeringClass() {
return offeringClass;
}
/**
*
* The instance family of the recommended reservation.
*
*
* @return The instance family of the recommended reservation.
*/
public final String instanceFamily() {
return instanceFamily;
}
/**
*
* The type of instance that Amazon Web Services recommends.
*
*
* @return The type of instance that Amazon Web Services recommends.
*/
public final String instanceType() {
return instanceType;
}
/**
*
* The Amazon Web Services Region of the commitment.
*
*
* @return The Amazon Web Services Region of the commitment.
*/
public final String reservedInstancesRegion() {
return reservedInstancesRegion;
}
/**
*
* Determines whether the recommendation is for a current generation instance.
*
*
* @return Determines whether the recommendation is for a current generation instance.
*/
public final String currentGeneration() {
return currentGeneration;
}
/**
*
* The platform of the recommended reservation. The platform is the specific combination of operating system,
* license model, and software on an instance.
*
*
* @return The platform of the recommended reservation. The platform is the specific combination of operating
* system, license model, and software on an instance.
*/
public final String platform() {
return platform;
}
/**
*
* Determines whether the recommended reservation is dedicated or shared.
*
*
* @return Determines whether the recommended reservation is dedicated or shared.
*/
public final String tenancy() {
return tenancy;
}
/**
*
* Determines whether the recommendation is size flexible.
*
*
* @return Determines whether the recommendation is size flexible.
*/
public final Boolean sizeFlexEligible() {
return sizeFlexEligible;
}
/**
*
* How much purchasing this instance costs you upfront.
*
*
* @return How much purchasing this instance costs you upfront.
*/
public final String upfrontCost() {
return upfrontCost;
}
/**
*
* How much purchasing reserved instances costs you on a monthly basis.
*
*
* @return How much purchasing reserved instances costs you on a monthly basis.
*/
public final String monthlyRecurringCost() {
return monthlyRecurringCost;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(accountScope());
hashCode = 31 * hashCode + Objects.hashCode(service());
hashCode = 31 * hashCode + Objects.hashCode(normalizedUnitsToPurchase());
hashCode = 31 * hashCode + Objects.hashCode(term());
hashCode = 31 * hashCode + Objects.hashCode(paymentOption());
hashCode = 31 * hashCode + Objects.hashCode(numberOfInstancesToPurchase());
hashCode = 31 * hashCode + Objects.hashCode(offeringClass());
hashCode = 31 * hashCode + Objects.hashCode(instanceFamily());
hashCode = 31 * hashCode + Objects.hashCode(instanceType());
hashCode = 31 * hashCode + Objects.hashCode(reservedInstancesRegion());
hashCode = 31 * hashCode + Objects.hashCode(currentGeneration());
hashCode = 31 * hashCode + Objects.hashCode(platform());
hashCode = 31 * hashCode + Objects.hashCode(tenancy());
hashCode = 31 * hashCode + Objects.hashCode(sizeFlexEligible());
hashCode = 31 * hashCode + Objects.hashCode(upfrontCost());
hashCode = 31 * hashCode + Objects.hashCode(monthlyRecurringCost());
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 Ec2ReservedInstancesConfiguration)) {
return false;
}
Ec2ReservedInstancesConfiguration other = (Ec2ReservedInstancesConfiguration) obj;
return Objects.equals(accountScope(), other.accountScope()) && Objects.equals(service(), other.service())
&& Objects.equals(normalizedUnitsToPurchase(), other.normalizedUnitsToPurchase())
&& Objects.equals(term(), other.term()) && Objects.equals(paymentOption(), other.paymentOption())
&& Objects.equals(numberOfInstancesToPurchase(), other.numberOfInstancesToPurchase())
&& Objects.equals(offeringClass(), other.offeringClass())
&& Objects.equals(instanceFamily(), other.instanceFamily())
&& Objects.equals(instanceType(), other.instanceType())
&& Objects.equals(reservedInstancesRegion(), other.reservedInstancesRegion())
&& Objects.equals(currentGeneration(), other.currentGeneration()) && Objects.equals(platform(), other.platform())
&& Objects.equals(tenancy(), other.tenancy()) && Objects.equals(sizeFlexEligible(), other.sizeFlexEligible())
&& Objects.equals(upfrontCost(), other.upfrontCost())
&& Objects.equals(monthlyRecurringCost(), other.monthlyRecurringCost());
}
/**
* 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("Ec2ReservedInstancesConfiguration").add("AccountScope", accountScope())
.add("Service", service()).add("NormalizedUnitsToPurchase", normalizedUnitsToPurchase()).add("Term", term())
.add("PaymentOption", paymentOption()).add("NumberOfInstancesToPurchase", numberOfInstancesToPurchase())
.add("OfferingClass", offeringClass()).add("InstanceFamily", instanceFamily())
.add("InstanceType", instanceType()).add("ReservedInstancesRegion", reservedInstancesRegion())
.add("CurrentGeneration", currentGeneration()).add("Platform", platform()).add("Tenancy", tenancy())
.add("SizeFlexEligible", sizeFlexEligible()).add("UpfrontCost", upfrontCost())
.add("MonthlyRecurringCost", monthlyRecurringCost()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "accountScope":
return Optional.ofNullable(clazz.cast(accountScope()));
case "service":
return Optional.ofNullable(clazz.cast(service()));
case "normalizedUnitsToPurchase":
return Optional.ofNullable(clazz.cast(normalizedUnitsToPurchase()));
case "term":
return Optional.ofNullable(clazz.cast(term()));
case "paymentOption":
return Optional.ofNullable(clazz.cast(paymentOption()));
case "numberOfInstancesToPurchase":
return Optional.ofNullable(clazz.cast(numberOfInstancesToPurchase()));
case "offeringClass":
return Optional.ofNullable(clazz.cast(offeringClass()));
case "instanceFamily":
return Optional.ofNullable(clazz.cast(instanceFamily()));
case "instanceType":
return Optional.ofNullable(clazz.cast(instanceType()));
case "reservedInstancesRegion":
return Optional.ofNullable(clazz.cast(reservedInstancesRegion()));
case "currentGeneration":
return Optional.ofNullable(clazz.cast(currentGeneration()));
case "platform":
return Optional.ofNullable(clazz.cast(platform()));
case "tenancy":
return Optional.ofNullable(clazz.cast(tenancy()));
case "sizeFlexEligible":
return Optional.ofNullable(clazz.cast(sizeFlexEligible()));
case "upfrontCost":
return Optional.ofNullable(clazz.cast(upfrontCost()));
case "monthlyRecurringCost":
return Optional.ofNullable(clazz.cast(monthlyRecurringCost()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function