
software.amazon.awssdk.services.storagegateway.model.DescribeCacheResponse 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.storagegateway.model;
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.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.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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class DescribeCacheResponse extends StorageGatewayResponse implements
ToCopyableBuilder {
private static final SdkField GATEWAY_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(DescribeCacheResponse::gatewayARN)).setter(setter(Builder::gatewayARN))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GatewayARN").build()).build();
private static final SdkField> DISK_IDS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.getter(getter(DescribeCacheResponse::diskIds))
.setter(setter(Builder::diskIds))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DiskIds").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 SdkField CACHE_ALLOCATED_IN_BYTES_FIELD = SdkField. builder(MarshallingType.LONG)
.getter(getter(DescribeCacheResponse::cacheAllocatedInBytes)).setter(setter(Builder::cacheAllocatedInBytes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CacheAllocatedInBytes").build())
.build();
private static final SdkField CACHE_USED_PERCENTAGE_FIELD = SdkField. builder(MarshallingType.DOUBLE)
.getter(getter(DescribeCacheResponse::cacheUsedPercentage)).setter(setter(Builder::cacheUsedPercentage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CacheUsedPercentage").build())
.build();
private static final SdkField CACHE_DIRTY_PERCENTAGE_FIELD = SdkField. builder(MarshallingType.DOUBLE)
.getter(getter(DescribeCacheResponse::cacheDirtyPercentage)).setter(setter(Builder::cacheDirtyPercentage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CacheDirtyPercentage").build())
.build();
private static final SdkField CACHE_HIT_PERCENTAGE_FIELD = SdkField. builder(MarshallingType.DOUBLE)
.getter(getter(DescribeCacheResponse::cacheHitPercentage)).setter(setter(Builder::cacheHitPercentage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CacheHitPercentage").build())
.build();
private static final SdkField CACHE_MISS_PERCENTAGE_FIELD = SdkField. builder(MarshallingType.DOUBLE)
.getter(getter(DescribeCacheResponse::cacheMissPercentage)).setter(setter(Builder::cacheMissPercentage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CacheMissPercentage").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(GATEWAY_ARN_FIELD,
DISK_IDS_FIELD, CACHE_ALLOCATED_IN_BYTES_FIELD, CACHE_USED_PERCENTAGE_FIELD, CACHE_DIRTY_PERCENTAGE_FIELD,
CACHE_HIT_PERCENTAGE_FIELD, CACHE_MISS_PERCENTAGE_FIELD));
private final String gatewayARN;
private final List diskIds;
private final Long cacheAllocatedInBytes;
private final Double cacheUsedPercentage;
private final Double cacheDirtyPercentage;
private final Double cacheHitPercentage;
private final Double cacheMissPercentage;
private DescribeCacheResponse(BuilderImpl builder) {
super(builder);
this.gatewayARN = builder.gatewayARN;
this.diskIds = builder.diskIds;
this.cacheAllocatedInBytes = builder.cacheAllocatedInBytes;
this.cacheUsedPercentage = builder.cacheUsedPercentage;
this.cacheDirtyPercentage = builder.cacheDirtyPercentage;
this.cacheHitPercentage = builder.cacheHitPercentage;
this.cacheMissPercentage = builder.cacheMissPercentage;
}
/**
* Returns the value of the GatewayARN property for this object.
*
* @return The value of the GatewayARN property for this object.
*/
public String gatewayARN() {
return gatewayARN;
}
/**
* Returns true if the DiskIds property was specified by the sender (it may be empty), or false if the sender did
* not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service.
*/
public boolean hasDiskIds() {
return diskIds != null && !(diskIds instanceof SdkAutoConstructList);
}
/**
*
* An array of strings that identify disks that are to be configured as working storage. Each string has a minimum
* length of 1 and maximum length of 300. You can get the disk IDs from the ListLocalDisks API.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasDiskIds()} to see if a value was sent in this field.
*
*
* @return An array of strings that identify disks that are to be configured as working storage. Each string has a
* minimum length of 1 and maximum length of 300. You can get the disk IDs from the ListLocalDisks
* API.
*/
public List diskIds() {
return diskIds;
}
/**
*
* The amount of cache in bytes allocated to a gateway.
*
*
* @return The amount of cache in bytes allocated to a gateway.
*/
public Long cacheAllocatedInBytes() {
return cacheAllocatedInBytes;
}
/**
*
* Percent use of the gateway's cache storage. This metric applies only to the gateway-cached volume setup. The
* sample is taken at the end of the reporting period.
*
*
* @return Percent use of the gateway's cache storage. This metric applies only to the gateway-cached volume setup.
* The sample is taken at the end of the reporting period.
*/
public Double cacheUsedPercentage() {
return cacheUsedPercentage;
}
/**
*
* The file share's contribution to the overall percentage of the gateway's cache that has not been persisted to
* AWS. The sample is taken at the end of the reporting period.
*
*
* @return The file share's contribution to the overall percentage of the gateway's cache that has not been
* persisted to AWS. The sample is taken at the end of the reporting period.
*/
public Double cacheDirtyPercentage() {
return cacheDirtyPercentage;
}
/**
*
* Percent of application read operations from the file shares that are served from cache. The sample is taken at
* the end of the reporting period.
*
*
* @return Percent of application read operations from the file shares that are served from cache. The sample is
* taken at the end of the reporting period.
*/
public Double cacheHitPercentage() {
return cacheHitPercentage;
}
/**
*
* Percent of application read operations from the file shares that are not served from cache. The sample is taken
* at the end of the reporting period.
*
*
* @return Percent of application read operations from the file shares that are not served from cache. The sample is
* taken at the end of the reporting period.
*/
public Double cacheMissPercentage() {
return cacheMissPercentage;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(gatewayARN());
hashCode = 31 * hashCode + Objects.hashCode(diskIds());
hashCode = 31 * hashCode + Objects.hashCode(cacheAllocatedInBytes());
hashCode = 31 * hashCode + Objects.hashCode(cacheUsedPercentage());
hashCode = 31 * hashCode + Objects.hashCode(cacheDirtyPercentage());
hashCode = 31 * hashCode + Objects.hashCode(cacheHitPercentage());
hashCode = 31 * hashCode + Objects.hashCode(cacheMissPercentage());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof DescribeCacheResponse)) {
return false;
}
DescribeCacheResponse other = (DescribeCacheResponse) obj;
return Objects.equals(gatewayARN(), other.gatewayARN()) && Objects.equals(diskIds(), other.diskIds())
&& Objects.equals(cacheAllocatedInBytes(), other.cacheAllocatedInBytes())
&& Objects.equals(cacheUsedPercentage(), other.cacheUsedPercentage())
&& Objects.equals(cacheDirtyPercentage(), other.cacheDirtyPercentage())
&& Objects.equals(cacheHitPercentage(), other.cacheHitPercentage())
&& Objects.equals(cacheMissPercentage(), other.cacheMissPercentage());
}
/**
* 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 String toString() {
return ToString.builder("DescribeCacheResponse").add("GatewayARN", gatewayARN()).add("DiskIds", diskIds())
.add("CacheAllocatedInBytes", cacheAllocatedInBytes()).add("CacheUsedPercentage", cacheUsedPercentage())
.add("CacheDirtyPercentage", cacheDirtyPercentage()).add("CacheHitPercentage", cacheHitPercentage())
.add("CacheMissPercentage", cacheMissPercentage()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "GatewayARN":
return Optional.ofNullable(clazz.cast(gatewayARN()));
case "DiskIds":
return Optional.ofNullable(clazz.cast(diskIds()));
case "CacheAllocatedInBytes":
return Optional.ofNullable(clazz.cast(cacheAllocatedInBytes()));
case "CacheUsedPercentage":
return Optional.ofNullable(clazz.cast(cacheUsedPercentage()));
case "CacheDirtyPercentage":
return Optional.ofNullable(clazz.cast(cacheDirtyPercentage()));
case "CacheHitPercentage":
return Optional.ofNullable(clazz.cast(cacheHitPercentage()));
case "CacheMissPercentage":
return Optional.ofNullable(clazz.cast(cacheMissPercentage()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function