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

software.amazon.awssdk.services.ec2.model.CapacityBlockOffering Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon EC2 module holds the client classes that are used for communicating with Amazon EC2 Service

The 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.ec2.model;

import java.io.Serializable;
import java.time.Instant;
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 recommended Capacity Block that fits your search requirements. *

*/ @Generated("software.amazon.awssdk:codegen") public final class CapacityBlockOffering implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField CAPACITY_BLOCK_OFFERING_ID_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("CapacityBlockOfferingId") .getter(getter(CapacityBlockOffering::capacityBlockOfferingId)) .setter(setter(Builder::capacityBlockOfferingId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CapacityBlockOfferingId") .unmarshallLocationName("capacityBlockOfferingId").build()).build(); private static final SdkField INSTANCE_TYPE_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("InstanceType") .getter(getter(CapacityBlockOffering::instanceType)) .setter(setter(Builder::instanceType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceType") .unmarshallLocationName("instanceType").build()).build(); private static final SdkField AVAILABILITY_ZONE_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("AvailabilityZone") .getter(getter(CapacityBlockOffering::availabilityZone)) .setter(setter(Builder::availabilityZone)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AvailabilityZone") .unmarshallLocationName("availabilityZone").build()).build(); private static final SdkField INSTANCE_COUNT_FIELD = SdkField . builder(MarshallingType.INTEGER) .memberName("InstanceCount") .getter(getter(CapacityBlockOffering::instanceCount)) .setter(setter(Builder::instanceCount)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceCount") .unmarshallLocationName("instanceCount").build()).build(); private static final SdkField START_DATE_FIELD = SdkField . builder(MarshallingType.INSTANT) .memberName("StartDate") .getter(getter(CapacityBlockOffering::startDate)) .setter(setter(Builder::startDate)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StartDate") .unmarshallLocationName("startDate").build()).build(); private static final SdkField END_DATE_FIELD = SdkField . builder(MarshallingType.INSTANT) .memberName("EndDate") .getter(getter(CapacityBlockOffering::endDate)) .setter(setter(Builder::endDate)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndDate") .unmarshallLocationName("endDate").build()).build(); private static final SdkField CAPACITY_BLOCK_DURATION_HOURS_FIELD = SdkField . builder(MarshallingType.INTEGER) .memberName("CapacityBlockDurationHours") .getter(getter(CapacityBlockOffering::capacityBlockDurationHours)) .setter(setter(Builder::capacityBlockDurationHours)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CapacityBlockDurationHours") .unmarshallLocationName("capacityBlockDurationHours").build()).build(); private static final SdkField UPFRONT_FEE_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("UpfrontFee") .getter(getter(CapacityBlockOffering::upfrontFee)) .setter(setter(Builder::upfrontFee)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UpfrontFee") .unmarshallLocationName("upfrontFee").build()).build(); private static final SdkField CURRENCY_CODE_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("CurrencyCode") .getter(getter(CapacityBlockOffering::currencyCode)) .setter(setter(Builder::currencyCode)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CurrencyCode") .unmarshallLocationName("currencyCode").build()).build(); private static final SdkField TENANCY_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("Tenancy") .getter(getter(CapacityBlockOffering::tenancyAsString)) .setter(setter(Builder::tenancy)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Tenancy") .unmarshallLocationName("tenancy").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList( CAPACITY_BLOCK_OFFERING_ID_FIELD, INSTANCE_TYPE_FIELD, AVAILABILITY_ZONE_FIELD, INSTANCE_COUNT_FIELD, START_DATE_FIELD, END_DATE_FIELD, CAPACITY_BLOCK_DURATION_HOURS_FIELD, UPFRONT_FEE_FIELD, CURRENCY_CODE_FIELD, TENANCY_FIELD)); private static final Map> SDK_NAME_TO_FIELD = Collections .unmodifiableMap(new HashMap>() { { put("CapacityBlockOfferingId", CAPACITY_BLOCK_OFFERING_ID_FIELD); put("InstanceType", INSTANCE_TYPE_FIELD); put("AvailabilityZone", AVAILABILITY_ZONE_FIELD); put("InstanceCount", INSTANCE_COUNT_FIELD); put("StartDate", START_DATE_FIELD); put("EndDate", END_DATE_FIELD); put("CapacityBlockDurationHours", CAPACITY_BLOCK_DURATION_HOURS_FIELD); put("UpfrontFee", UPFRONT_FEE_FIELD); put("CurrencyCode", CURRENCY_CODE_FIELD); put("Tenancy", TENANCY_FIELD); } }); private static final long serialVersionUID = 1L; private final String capacityBlockOfferingId; private final String instanceType; private final String availabilityZone; private final Integer instanceCount; private final Instant startDate; private final Instant endDate; private final Integer capacityBlockDurationHours; private final String upfrontFee; private final String currencyCode; private final String tenancy; private CapacityBlockOffering(BuilderImpl builder) { this.capacityBlockOfferingId = builder.capacityBlockOfferingId; this.instanceType = builder.instanceType; this.availabilityZone = builder.availabilityZone; this.instanceCount = builder.instanceCount; this.startDate = builder.startDate; this.endDate = builder.endDate; this.capacityBlockDurationHours = builder.capacityBlockDurationHours; this.upfrontFee = builder.upfrontFee; this.currencyCode = builder.currencyCode; this.tenancy = builder.tenancy; } /** *

* The ID of the Capacity Block offering. *

* * @return The ID of the Capacity Block offering. */ public final String capacityBlockOfferingId() { return capacityBlockOfferingId; } /** *

* The instance type of the Capacity Block offering. *

* * @return The instance type of the Capacity Block offering. */ public final String instanceType() { return instanceType; } /** *

* The Availability Zone of the Capacity Block offering. *

* * @return The Availability Zone of the Capacity Block offering. */ public final String availabilityZone() { return availabilityZone; } /** *

* The number of instances in the Capacity Block offering. *

* * @return The number of instances in the Capacity Block offering. */ public final Integer instanceCount() { return instanceCount; } /** *

* The start date of the Capacity Block offering. *

* * @return The start date of the Capacity Block offering. */ public final Instant startDate() { return startDate; } /** *

* The end date of the Capacity Block offering. *

* * @return The end date of the Capacity Block offering. */ public final Instant endDate() { return endDate; } /** *

* The amount of time of the Capacity Block reservation in hours. *

* * @return The amount of time of the Capacity Block reservation in hours. */ public final Integer capacityBlockDurationHours() { return capacityBlockDurationHours; } /** *

* The total price to be paid up front. *

* * @return The total price to be paid up front. */ public final String upfrontFee() { return upfrontFee; } /** *

* The currency of the payment for the Capacity Block. *

* * @return The currency of the payment for the Capacity Block. */ public final String currencyCode() { return currencyCode; } /** *

* The tenancy of the Capacity Block. *

*

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

* * @return The tenancy of the Capacity Block. * @see CapacityReservationTenancy */ public final CapacityReservationTenancy tenancy() { return CapacityReservationTenancy.fromValue(tenancy); } /** *

* The tenancy of the Capacity Block. *

*

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

* * @return The tenancy of the Capacity Block. * @see CapacityReservationTenancy */ public final String tenancyAsString() { return tenancy; } @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(capacityBlockOfferingId()); hashCode = 31 * hashCode + Objects.hashCode(instanceType()); hashCode = 31 * hashCode + Objects.hashCode(availabilityZone()); hashCode = 31 * hashCode + Objects.hashCode(instanceCount()); hashCode = 31 * hashCode + Objects.hashCode(startDate()); hashCode = 31 * hashCode + Objects.hashCode(endDate()); hashCode = 31 * hashCode + Objects.hashCode(capacityBlockDurationHours()); hashCode = 31 * hashCode + Objects.hashCode(upfrontFee()); hashCode = 31 * hashCode + Objects.hashCode(currencyCode()); hashCode = 31 * hashCode + Objects.hashCode(tenancyAsString()); 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 CapacityBlockOffering)) { return false; } CapacityBlockOffering other = (CapacityBlockOffering) obj; return Objects.equals(capacityBlockOfferingId(), other.capacityBlockOfferingId()) && Objects.equals(instanceType(), other.instanceType()) && Objects.equals(availabilityZone(), other.availabilityZone()) && Objects.equals(instanceCount(), other.instanceCount()) && Objects.equals(startDate(), other.startDate()) && Objects.equals(endDate(), other.endDate()) && Objects.equals(capacityBlockDurationHours(), other.capacityBlockDurationHours()) && Objects.equals(upfrontFee(), other.upfrontFee()) && Objects.equals(currencyCode(), other.currencyCode()) && Objects.equals(tenancyAsString(), other.tenancyAsString()); } /** * 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("CapacityBlockOffering").add("CapacityBlockOfferingId", capacityBlockOfferingId()) .add("InstanceType", instanceType()).add("AvailabilityZone", availabilityZone()) .add("InstanceCount", instanceCount()).add("StartDate", startDate()).add("EndDate", endDate()) .add("CapacityBlockDurationHours", capacityBlockDurationHours()).add("UpfrontFee", upfrontFee()) .add("CurrencyCode", currencyCode()).add("Tenancy", tenancyAsString()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "CapacityBlockOfferingId": return Optional.ofNullable(clazz.cast(capacityBlockOfferingId())); case "InstanceType": return Optional.ofNullable(clazz.cast(instanceType())); case "AvailabilityZone": return Optional.ofNullable(clazz.cast(availabilityZone())); case "InstanceCount": return Optional.ofNullable(clazz.cast(instanceCount())); case "StartDate": return Optional.ofNullable(clazz.cast(startDate())); case "EndDate": return Optional.ofNullable(clazz.cast(endDate())); case "CapacityBlockDurationHours": return Optional.ofNullable(clazz.cast(capacityBlockDurationHours())); case "UpfrontFee": return Optional.ofNullable(clazz.cast(upfrontFee())); case "CurrencyCode": return Optional.ofNullable(clazz.cast(currencyCode())); case "Tenancy": return Optional.ofNullable(clazz.cast(tenancyAsString())); 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 getter(Function g) { return obj -> g.apply((CapacityBlockOffering) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The ID of the Capacity Block offering. *

* * @param capacityBlockOfferingId * The ID of the Capacity Block offering. * @return Returns a reference to this object so that method calls can be chained together. */ Builder capacityBlockOfferingId(String capacityBlockOfferingId); /** *

* The instance type of the Capacity Block offering. *

* * @param instanceType * The instance type of the Capacity Block offering. * @return Returns a reference to this object so that method calls can be chained together. */ Builder instanceType(String instanceType); /** *

* The Availability Zone of the Capacity Block offering. *

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

* The number of instances in the Capacity Block offering. *

* * @param instanceCount * The number of instances in the Capacity Block offering. * @return Returns a reference to this object so that method calls can be chained together. */ Builder instanceCount(Integer instanceCount); /** *

* The start date of the Capacity Block offering. *

* * @param startDate * The start date of the Capacity Block offering. * @return Returns a reference to this object so that method calls can be chained together. */ Builder startDate(Instant startDate); /** *

* The end date of the Capacity Block offering. *

* * @param endDate * The end date of the Capacity Block offering. * @return Returns a reference to this object so that method calls can be chained together. */ Builder endDate(Instant endDate); /** *

* The amount of time of the Capacity Block reservation in hours. *

* * @param capacityBlockDurationHours * The amount of time of the Capacity Block reservation in hours. * @return Returns a reference to this object so that method calls can be chained together. */ Builder capacityBlockDurationHours(Integer capacityBlockDurationHours); /** *

* The total price to be paid up front. *

* * @param upfrontFee * The total price to be paid up front. * @return Returns a reference to this object so that method calls can be chained together. */ Builder upfrontFee(String upfrontFee); /** *

* The currency of the payment for the Capacity Block. *

* * @param currencyCode * The currency of the payment for the Capacity Block. * @return Returns a reference to this object so that method calls can be chained together. */ Builder currencyCode(String currencyCode); /** *

* The tenancy of the Capacity Block. *

* * @param tenancy * The tenancy of the Capacity Block. * @see CapacityReservationTenancy * @return Returns a reference to this object so that method calls can be chained together. * @see CapacityReservationTenancy */ Builder tenancy(String tenancy); /** *

* The tenancy of the Capacity Block. *

* * @param tenancy * The tenancy of the Capacity Block. * @see CapacityReservationTenancy * @return Returns a reference to this object so that method calls can be chained together. * @see CapacityReservationTenancy */ Builder tenancy(CapacityReservationTenancy tenancy); } static final class BuilderImpl implements Builder { private String capacityBlockOfferingId; private String instanceType; private String availabilityZone; private Integer instanceCount; private Instant startDate; private Instant endDate; private Integer capacityBlockDurationHours; private String upfrontFee; private String currencyCode; private String tenancy; private BuilderImpl() { } private BuilderImpl(CapacityBlockOffering model) { capacityBlockOfferingId(model.capacityBlockOfferingId); instanceType(model.instanceType); availabilityZone(model.availabilityZone); instanceCount(model.instanceCount); startDate(model.startDate); endDate(model.endDate); capacityBlockDurationHours(model.capacityBlockDurationHours); upfrontFee(model.upfrontFee); currencyCode(model.currencyCode); tenancy(model.tenancy); } public final String getCapacityBlockOfferingId() { return capacityBlockOfferingId; } public final void setCapacityBlockOfferingId(String capacityBlockOfferingId) { this.capacityBlockOfferingId = capacityBlockOfferingId; } @Override public final Builder capacityBlockOfferingId(String capacityBlockOfferingId) { this.capacityBlockOfferingId = capacityBlockOfferingId; 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 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 Integer getInstanceCount() { return instanceCount; } public final void setInstanceCount(Integer instanceCount) { this.instanceCount = instanceCount; } @Override public final Builder instanceCount(Integer instanceCount) { this.instanceCount = instanceCount; return this; } public final Instant getStartDate() { return startDate; } public final void setStartDate(Instant startDate) { this.startDate = startDate; } @Override public final Builder startDate(Instant startDate) { this.startDate = startDate; return this; } public final Instant getEndDate() { return endDate; } public final void setEndDate(Instant endDate) { this.endDate = endDate; } @Override public final Builder endDate(Instant endDate) { this.endDate = endDate; return this; } public final Integer getCapacityBlockDurationHours() { return capacityBlockDurationHours; } public final void setCapacityBlockDurationHours(Integer capacityBlockDurationHours) { this.capacityBlockDurationHours = capacityBlockDurationHours; } @Override public final Builder capacityBlockDurationHours(Integer capacityBlockDurationHours) { this.capacityBlockDurationHours = capacityBlockDurationHours; return this; } public final String getUpfrontFee() { return upfrontFee; } public final void setUpfrontFee(String upfrontFee) { this.upfrontFee = upfrontFee; } @Override public final Builder upfrontFee(String upfrontFee) { this.upfrontFee = upfrontFee; return this; } public final String getCurrencyCode() { return currencyCode; } public final void setCurrencyCode(String currencyCode) { this.currencyCode = currencyCode; } @Override public final Builder currencyCode(String currencyCode) { this.currencyCode = currencyCode; 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; } @Override public final Builder tenancy(CapacityReservationTenancy tenancy) { this.tenancy(tenancy == null ? null : tenancy.toString()); return this; } @Override public CapacityBlockOffering build() { return new CapacityBlockOffering(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy