
software.amazon.awssdk.services.medialive.model.DescribeOfferingResponse 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.medialive.model;
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;
/**
* Placeholder documentation for DescribeOfferingResponse
*/
@Generated("software.amazon.awssdk:codegen")
public final class DescribeOfferingResponse extends MediaLiveResponse implements
ToCopyableBuilder {
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Arn")
.getter(getter(DescribeOfferingResponse::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("arn").build()).build();
private static final SdkField CURRENCY_CODE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CurrencyCode").getter(getter(DescribeOfferingResponse::currencyCode))
.setter(setter(Builder::currencyCode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("currencyCode").build()).build();
private static final SdkField DURATION_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("Duration").getter(getter(DescribeOfferingResponse::duration)).setter(setter(Builder::duration))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("duration").build()).build();
private static final SdkField DURATION_UNITS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DurationUnits").getter(getter(DescribeOfferingResponse::durationUnitsAsString))
.setter(setter(Builder::durationUnits))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("durationUnits").build()).build();
private static final SdkField FIXED_PRICE_FIELD = SdkField. builder(MarshallingType.DOUBLE)
.memberName("FixedPrice").getter(getter(DescribeOfferingResponse::fixedPrice)).setter(setter(Builder::fixedPrice))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("fixedPrice").build()).build();
private static final SdkField OFFERING_DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("OfferingDescription").getter(getter(DescribeOfferingResponse::offeringDescription))
.setter(setter(Builder::offeringDescription))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("offeringDescription").build())
.build();
private static final SdkField OFFERING_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("OfferingId").getter(getter(DescribeOfferingResponse::offeringId)).setter(setter(Builder::offeringId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("offeringId").build()).build();
private static final SdkField OFFERING_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("OfferingType").getter(getter(DescribeOfferingResponse::offeringTypeAsString))
.setter(setter(Builder::offeringType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("offeringType").build()).build();
private static final SdkField REGION_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Region")
.getter(getter(DescribeOfferingResponse::region)).setter(setter(Builder::region))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("region").build()).build();
private static final SdkField RESOURCE_SPECIFICATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ResourceSpecification")
.getter(getter(DescribeOfferingResponse::resourceSpecification)).setter(setter(Builder::resourceSpecification))
.constructor(ReservationResourceSpecification::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("resourceSpecification").build())
.build();
private static final SdkField USAGE_PRICE_FIELD = SdkField. builder(MarshallingType.DOUBLE)
.memberName("UsagePrice").getter(getter(DescribeOfferingResponse::usagePrice)).setter(setter(Builder::usagePrice))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("usagePrice").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD,
CURRENCY_CODE_FIELD, DURATION_FIELD, DURATION_UNITS_FIELD, FIXED_PRICE_FIELD, OFFERING_DESCRIPTION_FIELD,
OFFERING_ID_FIELD, OFFERING_TYPE_FIELD, REGION_FIELD, RESOURCE_SPECIFICATION_FIELD, USAGE_PRICE_FIELD));
private final String arn;
private final String currencyCode;
private final Integer duration;
private final String durationUnits;
private final Double fixedPrice;
private final String offeringDescription;
private final String offeringId;
private final String offeringType;
private final String region;
private final ReservationResourceSpecification resourceSpecification;
private final Double usagePrice;
private DescribeOfferingResponse(BuilderImpl builder) {
super(builder);
this.arn = builder.arn;
this.currencyCode = builder.currencyCode;
this.duration = builder.duration;
this.durationUnits = builder.durationUnits;
this.fixedPrice = builder.fixedPrice;
this.offeringDescription = builder.offeringDescription;
this.offeringId = builder.offeringId;
this.offeringType = builder.offeringType;
this.region = builder.region;
this.resourceSpecification = builder.resourceSpecification;
this.usagePrice = builder.usagePrice;
}
/**
* Unique offering ARN, e.g. 'arn:aws:medialive:us-west-2:123456789012:offering:87654321'
*
* @return Unique offering ARN, e.g. 'arn:aws:medialive:us-west-2:123456789012:offering:87654321'
*/
public final String arn() {
return arn;
}
/**
* Currency code for usagePrice and fixedPrice in ISO-4217 format, e.g. 'USD'
*
* @return Currency code for usagePrice and fixedPrice in ISO-4217 format, e.g. 'USD'
*/
public final String currencyCode() {
return currencyCode;
}
/**
* Lease duration, e.g. '12'
*
* @return Lease duration, e.g. '12'
*/
public final Integer duration() {
return duration;
}
/**
* Units for duration, e.g. 'MONTHS'
*
* If the service returns an enum value that is not available in the current SDK version, {@link #durationUnits}
* will return {@link OfferingDurationUnits#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #durationUnitsAsString}.
*
*
* @return Units for duration, e.g. 'MONTHS'
* @see OfferingDurationUnits
*/
public final OfferingDurationUnits durationUnits() {
return OfferingDurationUnits.fromValue(durationUnits);
}
/**
* Units for duration, e.g. 'MONTHS'
*
* If the service returns an enum value that is not available in the current SDK version, {@link #durationUnits}
* will return {@link OfferingDurationUnits#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #durationUnitsAsString}.
*
*
* @return Units for duration, e.g. 'MONTHS'
* @see OfferingDurationUnits
*/
public final String durationUnitsAsString() {
return durationUnits;
}
/**
* One-time charge for each reserved resource, e.g. '0.0' for a NO_UPFRONT offering
*
* @return One-time charge for each reserved resource, e.g. '0.0' for a NO_UPFRONT offering
*/
public final Double fixedPrice() {
return fixedPrice;
}
/**
* Offering description, e.g. 'HD AVC output at 10-20 Mbps, 30 fps, and standard VQ in US West (Oregon)'
*
* @return Offering description, e.g. 'HD AVC output at 10-20 Mbps, 30 fps, and standard VQ in US West (Oregon)'
*/
public final String offeringDescription() {
return offeringDescription;
}
/**
* Unique offering ID, e.g. '87654321'
*
* @return Unique offering ID, e.g. '87654321'
*/
public final String offeringId() {
return offeringId;
}
/**
* Offering type, e.g. 'NO_UPFRONT'
*
* If the service returns an enum value that is not available in the current SDK version, {@link #offeringType} will
* return {@link OfferingType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #offeringTypeAsString}.
*
*
* @return Offering type, e.g. 'NO_UPFRONT'
* @see OfferingType
*/
public final OfferingType offeringType() {
return OfferingType.fromValue(offeringType);
}
/**
* Offering type, e.g. 'NO_UPFRONT'
*
* If the service returns an enum value that is not available in the current SDK version, {@link #offeringType} will
* return {@link OfferingType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #offeringTypeAsString}.
*
*
* @return Offering type, e.g. 'NO_UPFRONT'
* @see OfferingType
*/
public final String offeringTypeAsString() {
return offeringType;
}
/**
* AWS region, e.g. 'us-west-2'
*
* @return AWS region, e.g. 'us-west-2'
*/
public final String region() {
return region;
}
/**
* Resource configuration details
*
* @return Resource configuration details
*/
public final ReservationResourceSpecification resourceSpecification() {
return resourceSpecification;
}
/**
* Recurring usage charge for each reserved resource, e.g. '157.0'
*
* @return Recurring usage charge for each reserved resource, e.g. '157.0'
*/
public final Double usagePrice() {
return usagePrice;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(arn());
hashCode = 31 * hashCode + Objects.hashCode(currencyCode());
hashCode = 31 * hashCode + Objects.hashCode(duration());
hashCode = 31 * hashCode + Objects.hashCode(durationUnitsAsString());
hashCode = 31 * hashCode + Objects.hashCode(fixedPrice());
hashCode = 31 * hashCode + Objects.hashCode(offeringDescription());
hashCode = 31 * hashCode + Objects.hashCode(offeringId());
hashCode = 31 * hashCode + Objects.hashCode(offeringTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(region());
hashCode = 31 * hashCode + Objects.hashCode(resourceSpecification());
hashCode = 31 * hashCode + Objects.hashCode(usagePrice());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof DescribeOfferingResponse)) {
return false;
}
DescribeOfferingResponse other = (DescribeOfferingResponse) obj;
return Objects.equals(arn(), other.arn()) && Objects.equals(currencyCode(), other.currencyCode())
&& Objects.equals(duration(), other.duration())
&& Objects.equals(durationUnitsAsString(), other.durationUnitsAsString())
&& Objects.equals(fixedPrice(), other.fixedPrice())
&& Objects.equals(offeringDescription(), other.offeringDescription())
&& Objects.equals(offeringId(), other.offeringId())
&& Objects.equals(offeringTypeAsString(), other.offeringTypeAsString())
&& Objects.equals(region(), other.region())
&& Objects.equals(resourceSpecification(), other.resourceSpecification())
&& Objects.equals(usagePrice(), other.usagePrice());
}
/**
* 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("DescribeOfferingResponse").add("Arn", arn()).add("CurrencyCode", currencyCode())
.add("Duration", duration()).add("DurationUnits", durationUnitsAsString()).add("FixedPrice", fixedPrice())
.add("OfferingDescription", offeringDescription()).add("OfferingId", offeringId())
.add("OfferingType", offeringTypeAsString()).add("Region", region())
.add("ResourceSpecification", resourceSpecification()).add("UsagePrice", usagePrice()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Arn":
return Optional.ofNullable(clazz.cast(arn()));
case "CurrencyCode":
return Optional.ofNullable(clazz.cast(currencyCode()));
case "Duration":
return Optional.ofNullable(clazz.cast(duration()));
case "DurationUnits":
return Optional.ofNullable(clazz.cast(durationUnitsAsString()));
case "FixedPrice":
return Optional.ofNullable(clazz.cast(fixedPrice()));
case "OfferingDescription":
return Optional.ofNullable(clazz.cast(offeringDescription()));
case "OfferingId":
return Optional.ofNullable(clazz.cast(offeringId()));
case "OfferingType":
return Optional.ofNullable(clazz.cast(offeringTypeAsString()));
case "Region":
return Optional.ofNullable(clazz.cast(region()));
case "ResourceSpecification":
return Optional.ofNullable(clazz.cast(resourceSpecification()));
case "UsagePrice":
return Optional.ofNullable(clazz.cast(usagePrice()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function