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

software.amazon.awssdk.services.outposts.model.CatalogItem Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Outposts module holds the client classes that are used for communicating with Outposts.

There is a newer version: 2.29.39
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.outposts.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
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 java.util.stream.Collectors;
import java.util.stream.Stream;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Information about a catalog item. *

*/ @Generated("software.amazon.awssdk:codegen") public final class CatalogItem implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField CATALOG_ITEM_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("CatalogItemId").getter(getter(CatalogItem::catalogItemId)).setter(setter(Builder::catalogItemId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CatalogItemId").build()).build(); private static final SdkField ITEM_STATUS_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ItemStatus").getter(getter(CatalogItem::itemStatusAsString)).setter(setter(Builder::itemStatus)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ItemStatus").build()).build(); private static final SdkField> EC2_CAPACITIES_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("EC2Capacities") .getter(getter(CatalogItem::ec2Capacities)) .setter(setter(Builder::ec2Capacities)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EC2Capacities").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(EC2Capacity::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField POWER_KVA_FIELD = SdkField. builder(MarshallingType.FLOAT).memberName("PowerKva") .getter(getter(CatalogItem::powerKva)).setter(setter(Builder::powerKva)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PowerKva").build()).build(); private static final SdkField WEIGHT_LBS_FIELD = SdkField. builder(MarshallingType.INTEGER) .memberName("WeightLbs").getter(getter(CatalogItem::weightLbs)).setter(setter(Builder::weightLbs)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("WeightLbs").build()).build(); private static final SdkField> SUPPORTED_UPLINK_GBPS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("SupportedUplinkGbps") .getter(getter(CatalogItem::supportedUplinkGbps)) .setter(setter(Builder::supportedUplinkGbps)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SupportedUplinkGbps").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.INTEGER) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField> SUPPORTED_STORAGE_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("SupportedStorage") .getter(getter(CatalogItem::supportedStorageAsStrings)) .setter(setter(Builder::supportedStorageWithStrings)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SupportedStorage").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CATALOG_ITEM_ID_FIELD, ITEM_STATUS_FIELD, EC2_CAPACITIES_FIELD, POWER_KVA_FIELD, WEIGHT_LBS_FIELD, SUPPORTED_UPLINK_GBPS_FIELD, SUPPORTED_STORAGE_FIELD)); private static final long serialVersionUID = 1L; private final String catalogItemId; private final String itemStatus; private final List ec2Capacities; private final Float powerKva; private final Integer weightLbs; private final List supportedUplinkGbps; private final List supportedStorage; private CatalogItem(BuilderImpl builder) { this.catalogItemId = builder.catalogItemId; this.itemStatus = builder.itemStatus; this.ec2Capacities = builder.ec2Capacities; this.powerKva = builder.powerKva; this.weightLbs = builder.weightLbs; this.supportedUplinkGbps = builder.supportedUplinkGbps; this.supportedStorage = builder.supportedStorage; } /** *

* The ID of the catalog item. *

* * @return The ID of the catalog item. */ public final String catalogItemId() { return catalogItemId; } /** *

* The status of a catalog item. *

*

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

* * @return The status of a catalog item. * @see CatalogItemStatus */ public final CatalogItemStatus itemStatus() { return CatalogItemStatus.fromValue(itemStatus); } /** *

* The status of a catalog item. *

*

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

* * @return The status of a catalog item. * @see CatalogItemStatus */ public final String itemStatusAsString() { return itemStatus; } /** * For responses, this returns true if the service returned a value for the EC2Capacities property. This DOES NOT * check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). * This is useful because the SDK will never return a null collection or map, but you may need to differentiate * between the service returning nothing (or null) and the service returning an empty collection or map. For * requests, this returns true if a value for the property was specified in the request builder, and false if a * value was not specified. */ public final boolean hasEc2Capacities() { return ec2Capacities != null && !(ec2Capacities instanceof SdkAutoConstructList); } /** *

* Information about the EC2 capacity of an item. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasEc2Capacities} method. *

* * @return Information about the EC2 capacity of an item. */ public final List ec2Capacities() { return ec2Capacities; } /** *

* Information about the power draw of an item. *

* * @return Information about the power draw of an item. */ public final Float powerKva() { return powerKva; } /** *

* The weight of the item in pounds. *

* * @return The weight of the item in pounds. */ public final Integer weightLbs() { return weightLbs; } /** * For responses, this returns true if the service returned a value for the SupportedUplinkGbps property. This DOES * NOT check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). * This is useful because the SDK will never return a null collection or map, but you may need to differentiate * between the service returning nothing (or null) and the service returning an empty collection or map. For * requests, this returns true if a value for the property was specified in the request builder, and false if a * value was not specified. */ public final boolean hasSupportedUplinkGbps() { return supportedUplinkGbps != null && !(supportedUplinkGbps instanceof SdkAutoConstructList); } /** *

* The uplink speed this catalog item requires for the connection to the Region. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasSupportedUplinkGbps} method. *

* * @return The uplink speed this catalog item requires for the connection to the Region. */ public final List supportedUplinkGbps() { return supportedUplinkGbps; } /** *

* The supported storage options for the catalog item. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasSupportedStorage} method. *

* * @return The supported storage options for the catalog item. */ public final List supportedStorage() { return SupportedStorageListCopier.copyStringToEnum(supportedStorage); } /** * For responses, this returns true if the service returned a value for the SupportedStorage property. This DOES NOT * check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). * This is useful because the SDK will never return a null collection or map, but you may need to differentiate * between the service returning nothing (or null) and the service returning an empty collection or map. For * requests, this returns true if a value for the property was specified in the request builder, and false if a * value was not specified. */ public final boolean hasSupportedStorage() { return supportedStorage != null && !(supportedStorage instanceof SdkAutoConstructList); } /** *

* The supported storage options for the catalog item. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasSupportedStorage} method. *

* * @return The supported storage options for the catalog item. */ public final List supportedStorageAsStrings() { return supportedStorage; } @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(catalogItemId()); hashCode = 31 * hashCode + Objects.hashCode(itemStatusAsString()); hashCode = 31 * hashCode + Objects.hashCode(hasEc2Capacities() ? ec2Capacities() : null); hashCode = 31 * hashCode + Objects.hashCode(powerKva()); hashCode = 31 * hashCode + Objects.hashCode(weightLbs()); hashCode = 31 * hashCode + Objects.hashCode(hasSupportedUplinkGbps() ? supportedUplinkGbps() : null); hashCode = 31 * hashCode + Objects.hashCode(hasSupportedStorage() ? supportedStorageAsStrings() : null); 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 CatalogItem)) { return false; } CatalogItem other = (CatalogItem) obj; return Objects.equals(catalogItemId(), other.catalogItemId()) && Objects.equals(itemStatusAsString(), other.itemStatusAsString()) && hasEc2Capacities() == other.hasEc2Capacities() && Objects.equals(ec2Capacities(), other.ec2Capacities()) && Objects.equals(powerKva(), other.powerKva()) && Objects.equals(weightLbs(), other.weightLbs()) && hasSupportedUplinkGbps() == other.hasSupportedUplinkGbps() && Objects.equals(supportedUplinkGbps(), other.supportedUplinkGbps()) && hasSupportedStorage() == other.hasSupportedStorage() && Objects.equals(supportedStorageAsStrings(), other.supportedStorageAsStrings()); } /** * 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("CatalogItem").add("CatalogItemId", catalogItemId()).add("ItemStatus", itemStatusAsString()) .add("EC2Capacities", hasEc2Capacities() ? ec2Capacities() : null).add("PowerKva", powerKva()) .add("WeightLbs", weightLbs()) .add("SupportedUplinkGbps", hasSupportedUplinkGbps() ? supportedUplinkGbps() : null) .add("SupportedStorage", hasSupportedStorage() ? supportedStorageAsStrings() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "CatalogItemId": return Optional.ofNullable(clazz.cast(catalogItemId())); case "ItemStatus": return Optional.ofNullable(clazz.cast(itemStatusAsString())); case "EC2Capacities": return Optional.ofNullable(clazz.cast(ec2Capacities())); case "PowerKva": return Optional.ofNullable(clazz.cast(powerKva())); case "WeightLbs": return Optional.ofNullable(clazz.cast(weightLbs())); case "SupportedUplinkGbps": return Optional.ofNullable(clazz.cast(supportedUplinkGbps())); case "SupportedStorage": return Optional.ofNullable(clazz.cast(supportedStorageAsStrings())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((CatalogItem) 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 catalog item. *

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

* The status of a catalog item. *

* * @param itemStatus * The status of a catalog item. * @see CatalogItemStatus * @return Returns a reference to this object so that method calls can be chained together. * @see CatalogItemStatus */ Builder itemStatus(String itemStatus); /** *

* The status of a catalog item. *

* * @param itemStatus * The status of a catalog item. * @see CatalogItemStatus * @return Returns a reference to this object so that method calls can be chained together. * @see CatalogItemStatus */ Builder itemStatus(CatalogItemStatus itemStatus); /** *

* Information about the EC2 capacity of an item. *

* * @param ec2Capacities * Information about the EC2 capacity of an item. * @return Returns a reference to this object so that method calls can be chained together. */ Builder ec2Capacities(Collection ec2Capacities); /** *

* Information about the EC2 capacity of an item. *

* * @param ec2Capacities * Information about the EC2 capacity of an item. * @return Returns a reference to this object so that method calls can be chained together. */ Builder ec2Capacities(EC2Capacity... ec2Capacities); /** *

* Information about the EC2 capacity of an item. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.outposts.model.EC2Capacity.Builder} avoiding the need to create one * manually via {@link software.amazon.awssdk.services.outposts.model.EC2Capacity#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.outposts.model.EC2Capacity.Builder#build()} is called immediately and * its result is passed to {@link #ec2Capacities(List)}. * * @param ec2Capacities * a consumer that will call methods on * {@link software.amazon.awssdk.services.outposts.model.EC2Capacity.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #ec2Capacities(java.util.Collection) */ Builder ec2Capacities(Consumer... ec2Capacities); /** *

* Information about the power draw of an item. *

* * @param powerKva * Information about the power draw of an item. * @return Returns a reference to this object so that method calls can be chained together. */ Builder powerKva(Float powerKva); /** *

* The weight of the item in pounds. *

* * @param weightLbs * The weight of the item in pounds. * @return Returns a reference to this object so that method calls can be chained together. */ Builder weightLbs(Integer weightLbs); /** *

* The uplink speed this catalog item requires for the connection to the Region. *

* * @param supportedUplinkGbps * The uplink speed this catalog item requires for the connection to the Region. * @return Returns a reference to this object so that method calls can be chained together. */ Builder supportedUplinkGbps(Collection supportedUplinkGbps); /** *

* The uplink speed this catalog item requires for the connection to the Region. *

* * @param supportedUplinkGbps * The uplink speed this catalog item requires for the connection to the Region. * @return Returns a reference to this object so that method calls can be chained together. */ Builder supportedUplinkGbps(Integer... supportedUplinkGbps); /** *

* The supported storage options for the catalog item. *

* * @param supportedStorage * The supported storage options for the catalog item. * @return Returns a reference to this object so that method calls can be chained together. */ Builder supportedStorageWithStrings(Collection supportedStorage); /** *

* The supported storage options for the catalog item. *

* * @param supportedStorage * The supported storage options for the catalog item. * @return Returns a reference to this object so that method calls can be chained together. */ Builder supportedStorageWithStrings(String... supportedStorage); /** *

* The supported storage options for the catalog item. *

* * @param supportedStorage * The supported storage options for the catalog item. * @return Returns a reference to this object so that method calls can be chained together. */ Builder supportedStorage(Collection supportedStorage); /** *

* The supported storage options for the catalog item. *

* * @param supportedStorage * The supported storage options for the catalog item. * @return Returns a reference to this object so that method calls can be chained together. */ Builder supportedStorage(SupportedStorageEnum... supportedStorage); } static final class BuilderImpl implements Builder { private String catalogItemId; private String itemStatus; private List ec2Capacities = DefaultSdkAutoConstructList.getInstance(); private Float powerKva; private Integer weightLbs; private List supportedUplinkGbps = DefaultSdkAutoConstructList.getInstance(); private List supportedStorage = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(CatalogItem model) { catalogItemId(model.catalogItemId); itemStatus(model.itemStatus); ec2Capacities(model.ec2Capacities); powerKva(model.powerKva); weightLbs(model.weightLbs); supportedUplinkGbps(model.supportedUplinkGbps); supportedStorageWithStrings(model.supportedStorage); } public final String getCatalogItemId() { return catalogItemId; } public final void setCatalogItemId(String catalogItemId) { this.catalogItemId = catalogItemId; } @Override public final Builder catalogItemId(String catalogItemId) { this.catalogItemId = catalogItemId; return this; } public final String getItemStatus() { return itemStatus; } public final void setItemStatus(String itemStatus) { this.itemStatus = itemStatus; } @Override public final Builder itemStatus(String itemStatus) { this.itemStatus = itemStatus; return this; } @Override public final Builder itemStatus(CatalogItemStatus itemStatus) { this.itemStatus(itemStatus == null ? null : itemStatus.toString()); return this; } public final List getEc2Capacities() { List result = EC2CapacityListDefinitionCopier.copyToBuilder(this.ec2Capacities); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setEc2Capacities(Collection ec2Capacities) { this.ec2Capacities = EC2CapacityListDefinitionCopier.copyFromBuilder(ec2Capacities); } @Override public final Builder ec2Capacities(Collection ec2Capacities) { this.ec2Capacities = EC2CapacityListDefinitionCopier.copy(ec2Capacities); return this; } @Override @SafeVarargs public final Builder ec2Capacities(EC2Capacity... ec2Capacities) { ec2Capacities(Arrays.asList(ec2Capacities)); return this; } @Override @SafeVarargs public final Builder ec2Capacities(Consumer... ec2Capacities) { ec2Capacities(Stream.of(ec2Capacities).map(c -> EC2Capacity.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final Float getPowerKva() { return powerKva; } public final void setPowerKva(Float powerKva) { this.powerKva = powerKva; } @Override public final Builder powerKva(Float powerKva) { this.powerKva = powerKva; return this; } public final Integer getWeightLbs() { return weightLbs; } public final void setWeightLbs(Integer weightLbs) { this.weightLbs = weightLbs; } @Override public final Builder weightLbs(Integer weightLbs) { this.weightLbs = weightLbs; return this; } public final Collection getSupportedUplinkGbps() { if (supportedUplinkGbps instanceof SdkAutoConstructList) { return null; } return supportedUplinkGbps; } public final void setSupportedUplinkGbps(Collection supportedUplinkGbps) { this.supportedUplinkGbps = SupportedUplinkGbpsListDefinitionCopier.copy(supportedUplinkGbps); } @Override public final Builder supportedUplinkGbps(Collection supportedUplinkGbps) { this.supportedUplinkGbps = SupportedUplinkGbpsListDefinitionCopier.copy(supportedUplinkGbps); return this; } @Override @SafeVarargs public final Builder supportedUplinkGbps(Integer... supportedUplinkGbps) { supportedUplinkGbps(Arrays.asList(supportedUplinkGbps)); return this; } public final Collection getSupportedStorage() { if (supportedStorage instanceof SdkAutoConstructList) { return null; } return supportedStorage; } public final void setSupportedStorage(Collection supportedStorage) { this.supportedStorage = SupportedStorageListCopier.copy(supportedStorage); } @Override public final Builder supportedStorageWithStrings(Collection supportedStorage) { this.supportedStorage = SupportedStorageListCopier.copy(supportedStorage); return this; } @Override @SafeVarargs public final Builder supportedStorageWithStrings(String... supportedStorage) { supportedStorageWithStrings(Arrays.asList(supportedStorage)); return this; } @Override public final Builder supportedStorage(Collection supportedStorage) { this.supportedStorage = SupportedStorageListCopier.copyEnumToString(supportedStorage); return this; } @Override @SafeVarargs public final Builder supportedStorage(SupportedStorageEnum... supportedStorage) { supportedStorage(Arrays.asList(supportedStorage)); return this; } @Override public CatalogItem build() { return new CatalogItem(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy