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

software.amazon.awssdk.services.costexplorer.model.EC2InstanceDetails 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.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;

/**
 * 

* Details about the Amazon EC2 reservations that Amazon Web Services recommends that you purchase. *

*/ @Generated("software.amazon.awssdk:codegen") public final class EC2InstanceDetails implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField FAMILY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Family") .getter(getter(EC2InstanceDetails::family)).setter(setter(Builder::family)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Family").build()).build(); private static final SdkField INSTANCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("InstanceType").getter(getter(EC2InstanceDetails::instanceType)).setter(setter(Builder::instanceType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceType").build()).build(); private static final SdkField REGION_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Region") .getter(getter(EC2InstanceDetails::region)).setter(setter(Builder::region)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Region").build()).build(); private static final SdkField AVAILABILITY_ZONE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("AvailabilityZone").getter(getter(EC2InstanceDetails::availabilityZone)) .setter(setter(Builder::availabilityZone)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AvailabilityZone").build()).build(); private static final SdkField PLATFORM_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("Platform").getter(getter(EC2InstanceDetails::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(EC2InstanceDetails::tenancy)).setter(setter(Builder::tenancy)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Tenancy").build()).build(); private static final SdkField CURRENT_GENERATION_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("CurrentGeneration").getter(getter(EC2InstanceDetails::currentGeneration)) .setter(setter(Builder::currentGeneration)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CurrentGeneration").build()).build(); private static final SdkField SIZE_FLEX_ELIGIBLE_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("SizeFlexEligible").getter(getter(EC2InstanceDetails::sizeFlexEligible)) .setter(setter(Builder::sizeFlexEligible)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SizeFlexEligible").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(FAMILY_FIELD, INSTANCE_TYPE_FIELD, REGION_FIELD, AVAILABILITY_ZONE_FIELD, PLATFORM_FIELD, TENANCY_FIELD, CURRENT_GENERATION_FIELD, SIZE_FLEX_ELIGIBLE_FIELD)); private static final long serialVersionUID = 1L; private final String family; private final String instanceType; private final String region; private final String availabilityZone; private final String platform; private final String tenancy; private final Boolean currentGeneration; private final Boolean sizeFlexEligible; private EC2InstanceDetails(BuilderImpl builder) { this.family = builder.family; this.instanceType = builder.instanceType; this.region = builder.region; this.availabilityZone = builder.availabilityZone; this.platform = builder.platform; this.tenancy = builder.tenancy; this.currentGeneration = builder.currentGeneration; this.sizeFlexEligible = builder.sizeFlexEligible; } /** *

* The instance family of the recommended reservation. *

* * @return The instance family of the recommended reservation. */ public final String family() { return family; } /** *

* 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 recommended reservation. *

* * @return The Amazon Web Services Region of the recommended reservation. */ public final String region() { return region; } /** *

* The Availability Zone of the recommended reservation. *

* * @return The Availability Zone of the recommended reservation. */ public final String availabilityZone() { return availabilityZone; } /** *

* 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 for a current-generation instance. *

* * @return Determines whether the recommendation is for a current-generation instance. */ public final Boolean currentGeneration() { return currentGeneration; } /** *

* Determines whether the recommended reservation is size flexible. *

* * @return Determines whether the recommended reservation is size flexible. */ public final Boolean sizeFlexEligible() { return sizeFlexEligible; } @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(family()); hashCode = 31 * hashCode + Objects.hashCode(instanceType()); hashCode = 31 * hashCode + Objects.hashCode(region()); hashCode = 31 * hashCode + Objects.hashCode(availabilityZone()); hashCode = 31 * hashCode + Objects.hashCode(platform()); hashCode = 31 * hashCode + Objects.hashCode(tenancy()); hashCode = 31 * hashCode + Objects.hashCode(currentGeneration()); hashCode = 31 * hashCode + Objects.hashCode(sizeFlexEligible()); 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 EC2InstanceDetails)) { return false; } EC2InstanceDetails other = (EC2InstanceDetails) obj; return Objects.equals(family(), other.family()) && Objects.equals(instanceType(), other.instanceType()) && Objects.equals(region(), other.region()) && Objects.equals(availabilityZone(), other.availabilityZone()) && Objects.equals(platform(), other.platform()) && Objects.equals(tenancy(), other.tenancy()) && Objects.equals(currentGeneration(), other.currentGeneration()) && Objects.equals(sizeFlexEligible(), other.sizeFlexEligible()); } /** * 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("EC2InstanceDetails").add("Family", family()).add("InstanceType", instanceType()) .add("Region", region()).add("AvailabilityZone", availabilityZone()).add("Platform", platform()) .add("Tenancy", tenancy()).add("CurrentGeneration", currentGeneration()) .add("SizeFlexEligible", sizeFlexEligible()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Family": return Optional.ofNullable(clazz.cast(family())); case "InstanceType": return Optional.ofNullable(clazz.cast(instanceType())); case "Region": return Optional.ofNullable(clazz.cast(region())); case "AvailabilityZone": return Optional.ofNullable(clazz.cast(availabilityZone())); case "Platform": return Optional.ofNullable(clazz.cast(platform())); case "Tenancy": return Optional.ofNullable(clazz.cast(tenancy())); case "CurrentGeneration": return Optional.ofNullable(clazz.cast(currentGeneration())); case "SizeFlexEligible": return Optional.ofNullable(clazz.cast(sizeFlexEligible())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((EC2InstanceDetails) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The instance family of the recommended reservation. *

* * @param family * The instance family of the recommended reservation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder family(String family); /** *

* The type of instance that Amazon Web Services recommends. *

* * @param instanceType * The type of instance that Amazon Web Services recommends. * @return Returns a reference to this object so that method calls can be chained together. */ Builder instanceType(String instanceType); /** *

* The Amazon Web Services Region of the recommended reservation. *

* * @param region * The Amazon Web Services Region of the recommended reservation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder region(String region); /** *

* The Availability Zone of the recommended reservation. *

* * @param availabilityZone * The Availability Zone of the recommended reservation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder availabilityZone(String availabilityZone); /** *

* The platform of the recommended reservation. The platform is the specific combination of operating system, * license model, and software on an instance. *

* * @param platform * The platform of the recommended reservation. The platform is the specific combination of operating * system, license model, and software on an instance. * @return Returns a reference to this object so that method calls can be chained together. */ Builder platform(String platform); /** *

* Determines whether the recommended reservation is dedicated or shared. *

* * @param tenancy * Determines whether the recommended reservation is dedicated or shared. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tenancy(String tenancy); /** *

* Determines whether the recommendation is for a current-generation instance. *

* * @param currentGeneration * Determines whether the recommendation is for a current-generation instance. * @return Returns a reference to this object so that method calls can be chained together. */ Builder currentGeneration(Boolean currentGeneration); /** *

* Determines whether the recommended reservation is size flexible. *

* * @param sizeFlexEligible * Determines whether the recommended reservation is size flexible. * @return Returns a reference to this object so that method calls can be chained together. */ Builder sizeFlexEligible(Boolean sizeFlexEligible); } static final class BuilderImpl implements Builder { private String family; private String instanceType; private String region; private String availabilityZone; private String platform; private String tenancy; private Boolean currentGeneration; private Boolean sizeFlexEligible; private BuilderImpl() { } private BuilderImpl(EC2InstanceDetails model) { family(model.family); instanceType(model.instanceType); region(model.region); availabilityZone(model.availabilityZone); platform(model.platform); tenancy(model.tenancy); currentGeneration(model.currentGeneration); sizeFlexEligible(model.sizeFlexEligible); } public final String getFamily() { return family; } public final void setFamily(String family) { this.family = family; } @Override public final Builder family(String family) { this.family = family; return this; } public final String getInstanceType() { return instanceType; } public final void setInstanceType(String instanceType) { this.instanceType = instanceType; } @Override public final Builder instanceType(String instanceType) { this.instanceType = instanceType; return this; } public final String getRegion() { return region; } public final void setRegion(String region) { this.region = region; } @Override public final Builder region(String region) { this.region = region; return this; } public final String getAvailabilityZone() { return availabilityZone; } public final void setAvailabilityZone(String availabilityZone) { this.availabilityZone = availabilityZone; } @Override public final Builder availabilityZone(String availabilityZone) { this.availabilityZone = availabilityZone; return this; } public final String getPlatform() { return platform; } public final void setPlatform(String platform) { this.platform = platform; } @Override public final Builder platform(String platform) { this.platform = platform; return this; } public final String getTenancy() { return tenancy; } public final void setTenancy(String tenancy) { this.tenancy = tenancy; } @Override public final Builder tenancy(String tenancy) { this.tenancy = tenancy; return this; } public final Boolean getCurrentGeneration() { return currentGeneration; } public final void setCurrentGeneration(Boolean currentGeneration) { this.currentGeneration = currentGeneration; } @Override public final Builder currentGeneration(Boolean currentGeneration) { this.currentGeneration = currentGeneration; return this; } public final Boolean getSizeFlexEligible() { return sizeFlexEligible; } public final void setSizeFlexEligible(Boolean sizeFlexEligible) { this.sizeFlexEligible = sizeFlexEligible; } @Override public final Builder sizeFlexEligible(Boolean sizeFlexEligible) { this.sizeFlexEligible = sizeFlexEligible; return this; } @Override public EC2InstanceDetails build() { return new EC2InstanceDetails(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy