software.amazon.awssdk.services.snowdevicemanagement.model.Capacity Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of snowdevicemanagement Show documentation
Show all versions of snowdevicemanagement Show documentation
The AWS Java SDK for Snow Device Management module holds the client classes that are used for
communicating with Snow Device Management.
/*
* 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.snowdevicemanagement.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;
/**
*
* The physical capacity of the Amazon Web Services Snow Family device.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Capacity implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField AVAILABLE_FIELD = SdkField. builder(MarshallingType.LONG).memberName("available")
.getter(getter(Capacity::available)).setter(setter(Builder::available))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("available").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("name")
.getter(getter(Capacity::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("name").build()).build();
private static final SdkField TOTAL_FIELD = SdkField. builder(MarshallingType.LONG).memberName("total")
.getter(getter(Capacity::total)).setter(setter(Builder::total))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("total").build()).build();
private static final SdkField UNIT_FIELD = SdkField. builder(MarshallingType.STRING).memberName("unit")
.getter(getter(Capacity::unit)).setter(setter(Builder::unit))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("unit").build()).build();
private static final SdkField USED_FIELD = SdkField. builder(MarshallingType.LONG).memberName("used")
.getter(getter(Capacity::used)).setter(setter(Builder::used))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("used").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(AVAILABLE_FIELD, NAME_FIELD,
TOTAL_FIELD, UNIT_FIELD, USED_FIELD));
private static final long serialVersionUID = 1L;
private final Long available;
private final String name;
private final Long total;
private final String unit;
private final Long used;
private Capacity(BuilderImpl builder) {
this.available = builder.available;
this.name = builder.name;
this.total = builder.total;
this.unit = builder.unit;
this.used = builder.used;
}
/**
*
* The amount of capacity available for use on the device.
*
*
* @return The amount of capacity available for use on the device.
*/
public final Long available() {
return available;
}
/**
*
* The name of the type of capacity, such as memory.
*
*
* @return The name of the type of capacity, such as memory.
*/
public final String name() {
return name;
}
/**
*
* The total capacity on the device.
*
*
* @return The total capacity on the device.
*/
public final Long total() {
return total;
}
/**
*
* The unit of measure for the type of capacity.
*
*
* @return The unit of measure for the type of capacity.
*/
public final String unit() {
return unit;
}
/**
*
* The amount of capacity used on the device.
*
*
* @return The amount of capacity used on the device.
*/
public final Long used() {
return used;
}
@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(available());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(total());
hashCode = 31 * hashCode + Objects.hashCode(unit());
hashCode = 31 * hashCode + Objects.hashCode(used());
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 Capacity)) {
return false;
}
Capacity other = (Capacity) obj;
return Objects.equals(available(), other.available()) && Objects.equals(name(), other.name())
&& Objects.equals(total(), other.total()) && Objects.equals(unit(), other.unit())
&& Objects.equals(used(), other.used());
}
/**
* 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("Capacity").add("Available", available()).add("Name", name()).add("Total", total())
.add("Unit", unit()).add("Used", used()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "available":
return Optional.ofNullable(clazz.cast(available()));
case "name":
return Optional.ofNullable(clazz.cast(name()));
case "total":
return Optional.ofNullable(clazz.cast(total()));
case "unit":
return Optional.ofNullable(clazz.cast(unit()));
case "used":
return Optional.ofNullable(clazz.cast(used()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function