software.amazon.awssdk.services.outposts.model.AssetInfo Maven / Gradle / Ivy
Show all versions of outposts Show documentation
/*
* 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.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;
/**
*
* Information about hardware assets.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class AssetInfo implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ASSET_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AssetId").getter(getter(AssetInfo::assetId)).setter(setter(Builder::assetId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AssetId").build()).build();
private static final SdkField RACK_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("RackId")
.getter(getter(AssetInfo::rackId)).setter(setter(Builder::rackId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RackId").build()).build();
private static final SdkField ASSET_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AssetType").getter(getter(AssetInfo::assetTypeAsString)).setter(setter(Builder::assetType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AssetType").build()).build();
private static final SdkField COMPUTE_ATTRIBUTES_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ComputeAttributes")
.getter(getter(AssetInfo::computeAttributes)).setter(setter(Builder::computeAttributes))
.constructor(ComputeAttributes::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ComputeAttributes").build()).build();
private static final SdkField ASSET_LOCATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("AssetLocation")
.getter(getter(AssetInfo::assetLocation)).setter(setter(Builder::assetLocation)).constructor(AssetLocation::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AssetLocation").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ASSET_ID_FIELD, RACK_ID_FIELD,
ASSET_TYPE_FIELD, COMPUTE_ATTRIBUTES_FIELD, ASSET_LOCATION_FIELD));
private static final long serialVersionUID = 1L;
private final String assetId;
private final String rackId;
private final String assetType;
private final ComputeAttributes computeAttributes;
private final AssetLocation assetLocation;
private AssetInfo(BuilderImpl builder) {
this.assetId = builder.assetId;
this.rackId = builder.rackId;
this.assetType = builder.assetType;
this.computeAttributes = builder.computeAttributes;
this.assetLocation = builder.assetLocation;
}
/**
*
* The ID of the asset.
*
*
* @return The ID of the asset.
*/
public final String assetId() {
return assetId;
}
/**
*
* The rack ID of the asset.
*
*
* @return The rack ID of the asset.
*/
public final String rackId() {
return rackId;
}
/**
*
* The type of the asset.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #assetType} will
* return {@link AssetType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #assetTypeAsString}.
*
*
* @return The type of the asset.
* @see AssetType
*/
public final AssetType assetType() {
return AssetType.fromValue(assetType);
}
/**
*
* The type of the asset.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #assetType} will
* return {@link AssetType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #assetTypeAsString}.
*
*
* @return The type of the asset.
* @see AssetType
*/
public final String assetTypeAsString() {
return assetType;
}
/**
*
* Information about compute hardware assets.
*
*
* @return Information about compute hardware assets.
*/
public final ComputeAttributes computeAttributes() {
return computeAttributes;
}
/**
*
* The position of an asset in a rack.
*
*
* @return The position of an asset in a rack.
*/
public final AssetLocation assetLocation() {
return assetLocation;
}
@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(assetId());
hashCode = 31 * hashCode + Objects.hashCode(rackId());
hashCode = 31 * hashCode + Objects.hashCode(assetTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(computeAttributes());
hashCode = 31 * hashCode + Objects.hashCode(assetLocation());
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 AssetInfo)) {
return false;
}
AssetInfo other = (AssetInfo) obj;
return Objects.equals(assetId(), other.assetId()) && Objects.equals(rackId(), other.rackId())
&& Objects.equals(assetTypeAsString(), other.assetTypeAsString())
&& Objects.equals(computeAttributes(), other.computeAttributes())
&& Objects.equals(assetLocation(), other.assetLocation());
}
/**
* 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("AssetInfo").add("AssetId", assetId()).add("RackId", rackId())
.add("AssetType", assetTypeAsString()).add("ComputeAttributes", computeAttributes())
.add("AssetLocation", assetLocation()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AssetId":
return Optional.ofNullable(clazz.cast(assetId()));
case "RackId":
return Optional.ofNullable(clazz.cast(rackId()));
case "AssetType":
return Optional.ofNullable(clazz.cast(assetTypeAsString()));
case "ComputeAttributes":
return Optional.ofNullable(clazz.cast(computeAttributes()));
case "AssetLocation":
return Optional.ofNullable(clazz.cast(assetLocation()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function