software.amazon.awssdk.services.costoptimizationhub.model.RdsReservedInstancesConfiguration Maven / Gradle / Ivy
/*
* 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.HashMap;
import java.util.List;
import java.util.Map;
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 RDS reserved instances configuration used for recommendations.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class RdsReservedInstancesConfiguration implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ACCOUNT_SCOPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("accountScope").getter(getter(RdsReservedInstancesConfiguration::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(RdsReservedInstancesConfiguration::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(RdsReservedInstancesConfiguration::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(RdsReservedInstancesConfiguration::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(RdsReservedInstancesConfiguration::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(RdsReservedInstancesConfiguration::numberOfInstancesToPurchase))
.setter(setter(Builder::numberOfInstancesToPurchase))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("numberOfInstancesToPurchase")
.build()).build();
private static final SdkField INSTANCE_FAMILY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("instanceFamily").getter(getter(RdsReservedInstancesConfiguration::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(RdsReservedInstancesConfiguration::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(RdsReservedInstancesConfiguration::reservedInstancesRegion))
.setter(setter(Builder::reservedInstancesRegion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("reservedInstancesRegion").build())
.build();
private static final SdkField SIZE_FLEX_ELIGIBLE_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("sizeFlexEligible").getter(getter(RdsReservedInstancesConfiguration::sizeFlexEligible))
.setter(setter(Builder::sizeFlexEligible))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("sizeFlexEligible").build()).build();
private static final SdkField CURRENT_GENERATION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("currentGeneration").getter(getter(RdsReservedInstancesConfiguration::currentGeneration))
.setter(setter(Builder::currentGeneration))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("currentGeneration").build()).build();
private static final SdkField UPFRONT_COST_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("upfrontCost").getter(getter(RdsReservedInstancesConfiguration::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(RdsReservedInstancesConfiguration::monthlyRecurringCost))
.setter(setter(Builder::monthlyRecurringCost))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("monthlyRecurringCost").build())
.build();
private static final SdkField LICENSE_MODEL_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("licenseModel").getter(getter(RdsReservedInstancesConfiguration::licenseModel))
.setter(setter(Builder::licenseModel))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("licenseModel").build()).build();
private static final SdkField DATABASE_EDITION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("databaseEdition").getter(getter(RdsReservedInstancesConfiguration::databaseEdition))
.setter(setter(Builder::databaseEdition))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("databaseEdition").build()).build();
private static final SdkField DATABASE_ENGINE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("databaseEngine").getter(getter(RdsReservedInstancesConfiguration::databaseEngine))
.setter(setter(Builder::databaseEngine))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("databaseEngine").build()).build();
private static final SdkField DEPLOYMENT_OPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("deploymentOption").getter(getter(RdsReservedInstancesConfiguration::deploymentOption))
.setter(setter(Builder::deploymentOption))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("deploymentOption").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, INSTANCE_FAMILY_FIELD, INSTANCE_TYPE_FIELD, RESERVED_INSTANCES_REGION_FIELD,
SIZE_FLEX_ELIGIBLE_FIELD, CURRENT_GENERATION_FIELD, UPFRONT_COST_FIELD, MONTHLY_RECURRING_COST_FIELD,
LICENSE_MODEL_FIELD, DATABASE_EDITION_FIELD, DATABASE_ENGINE_FIELD, DEPLOYMENT_OPTION_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("accountScope", ACCOUNT_SCOPE_FIELD);
put("service", SERVICE_FIELD);
put("normalizedUnitsToPurchase", NORMALIZED_UNITS_TO_PURCHASE_FIELD);
put("term", TERM_FIELD);
put("paymentOption", PAYMENT_OPTION_FIELD);
put("numberOfInstancesToPurchase", NUMBER_OF_INSTANCES_TO_PURCHASE_FIELD);
put("instanceFamily", INSTANCE_FAMILY_FIELD);
put("instanceType", INSTANCE_TYPE_FIELD);
put("reservedInstancesRegion", RESERVED_INSTANCES_REGION_FIELD);
put("sizeFlexEligible", SIZE_FLEX_ELIGIBLE_FIELD);
put("currentGeneration", CURRENT_GENERATION_FIELD);
put("upfrontCost", UPFRONT_COST_FIELD);
put("monthlyRecurringCost", MONTHLY_RECURRING_COST_FIELD);
put("licenseModel", LICENSE_MODEL_FIELD);
put("databaseEdition", DATABASE_EDITION_FIELD);
put("databaseEngine", DATABASE_ENGINE_FIELD);
put("deploymentOption", DEPLOYMENT_OPTION_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 instanceFamily;
private final String instanceType;
private final String reservedInstancesRegion;
private final Boolean sizeFlexEligible;
private final String currentGeneration;
private final String upfrontCost;
private final String monthlyRecurringCost;
private final String licenseModel;
private final String databaseEdition;
private final String databaseEngine;
private final String deploymentOption;
private RdsReservedInstancesConfiguration(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.instanceFamily = builder.instanceFamily;
this.instanceType = builder.instanceType;
this.reservedInstancesRegion = builder.reservedInstancesRegion;
this.sizeFlexEligible = builder.sizeFlexEligible;
this.currentGeneration = builder.currentGeneration;
this.upfrontCost = builder.upfrontCost;
this.monthlyRecurringCost = builder.monthlyRecurringCost;
this.licenseModel = builder.licenseModel;
this.databaseEdition = builder.databaseEdition;
this.databaseEngine = builder.databaseEngine;
this.deploymentOption = builder.deploymentOption;
}
/**
*
* 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;
}
/**
*
* 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 size flexible.
*
*
* @return Determines whether the recommendation is size flexible.
*/
public final Boolean sizeFlexEligible() {
return sizeFlexEligible;
}
/**
*
* 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;
}
/**
*
* 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 this instance costs you on a monthly basis.
*
*
* @return How much purchasing this instance costs you on a monthly basis.
*/
public final String monthlyRecurringCost() {
return monthlyRecurringCost;
}
/**
*
* The license model that the recommended reservation supports.
*
*
* @return The license model that the recommended reservation supports.
*/
public final String licenseModel() {
return licenseModel;
}
/**
*
* The database edition that the recommended reservation supports.
*
*
* @return The database edition that the recommended reservation supports.
*/
public final String databaseEdition() {
return databaseEdition;
}
/**
*
* The database engine that the recommended reservation supports.
*
*
* @return The database engine that the recommended reservation supports.
*/
public final String databaseEngine() {
return databaseEngine;
}
/**
*
* Determines whether the recommendation is for a reservation in a single Availability Zone or a reservation with a
* backup in a second Availability Zone.
*
*
* @return Determines whether the recommendation is for a reservation in a single Availability Zone or a reservation
* with a backup in a second Availability Zone.
*/
public final String deploymentOption() {
return deploymentOption;
}
@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(instanceFamily());
hashCode = 31 * hashCode + Objects.hashCode(instanceType());
hashCode = 31 * hashCode + Objects.hashCode(reservedInstancesRegion());
hashCode = 31 * hashCode + Objects.hashCode(sizeFlexEligible());
hashCode = 31 * hashCode + Objects.hashCode(currentGeneration());
hashCode = 31 * hashCode + Objects.hashCode(upfrontCost());
hashCode = 31 * hashCode + Objects.hashCode(monthlyRecurringCost());
hashCode = 31 * hashCode + Objects.hashCode(licenseModel());
hashCode = 31 * hashCode + Objects.hashCode(databaseEdition());
hashCode = 31 * hashCode + Objects.hashCode(databaseEngine());
hashCode = 31 * hashCode + Objects.hashCode(deploymentOption());
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 RdsReservedInstancesConfiguration)) {
return false;
}
RdsReservedInstancesConfiguration other = (RdsReservedInstancesConfiguration) 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(instanceFamily(), other.instanceFamily())
&& Objects.equals(instanceType(), other.instanceType())
&& Objects.equals(reservedInstancesRegion(), other.reservedInstancesRegion())
&& Objects.equals(sizeFlexEligible(), other.sizeFlexEligible())
&& Objects.equals(currentGeneration(), other.currentGeneration())
&& Objects.equals(upfrontCost(), other.upfrontCost())
&& Objects.equals(monthlyRecurringCost(), other.monthlyRecurringCost())
&& Objects.equals(licenseModel(), other.licenseModel())
&& Objects.equals(databaseEdition(), other.databaseEdition())
&& Objects.equals(databaseEngine(), other.databaseEngine())
&& Objects.equals(deploymentOption(), other.deploymentOption());
}
/**
* 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("RdsReservedInstancesConfiguration").add("AccountScope", accountScope())
.add("Service", service()).add("NormalizedUnitsToPurchase", normalizedUnitsToPurchase()).add("Term", term())
.add("PaymentOption", paymentOption()).add("NumberOfInstancesToPurchase", numberOfInstancesToPurchase())
.add("InstanceFamily", instanceFamily()).add("InstanceType", instanceType())
.add("ReservedInstancesRegion", reservedInstancesRegion()).add("SizeFlexEligible", sizeFlexEligible())
.add("CurrentGeneration", currentGeneration()).add("UpfrontCost", upfrontCost())
.add("MonthlyRecurringCost", monthlyRecurringCost()).add("LicenseModel", licenseModel())
.add("DatabaseEdition", databaseEdition()).add("DatabaseEngine", databaseEngine())
.add("DeploymentOption", deploymentOption()).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 "instanceFamily":
return Optional.ofNullable(clazz.cast(instanceFamily()));
case "instanceType":
return Optional.ofNullable(clazz.cast(instanceType()));
case "reservedInstancesRegion":
return Optional.ofNullable(clazz.cast(reservedInstancesRegion()));
case "sizeFlexEligible":
return Optional.ofNullable(clazz.cast(sizeFlexEligible()));
case "currentGeneration":
return Optional.ofNullable(clazz.cast(currentGeneration()));
case "upfrontCost":
return Optional.ofNullable(clazz.cast(upfrontCost()));
case "monthlyRecurringCost":
return Optional.ofNullable(clazz.cast(monthlyRecurringCost()));
case "licenseModel":
return Optional.ofNullable(clazz.cast(licenseModel()));
case "databaseEdition":
return Optional.ofNullable(clazz.cast(databaseEdition()));
case "databaseEngine":
return Optional.ofNullable(clazz.cast(databaseEngine()));
case "deploymentOption":
return Optional.ofNullable(clazz.cast(deploymentOption()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Function