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

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 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 getter(Function g) { return obj -> g.apply((DescribeCacheResponse) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends StorageGatewayResponse.Builder, SdkPojo, CopyableBuilder { /** * Sets the value of the GatewayARN property for this object. * * @param gatewayARN * The new value for the GatewayARN property for this object. * @return Returns a reference to this object so that method calls can be chained together. */ Builder gatewayARN(String gatewayARN); /** *

* 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. *

* * @param diskIds * 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. * @return Returns a reference to this object so that method calls can be chained together. */ Builder diskIds(Collection diskIds); /** *

* 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. *

* * @param diskIds * 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. * @return Returns a reference to this object so that method calls can be chained together. */ Builder diskIds(String... diskIds); /** *

* The amount of cache in bytes allocated to a gateway. *

* * @param cacheAllocatedInBytes * The amount of cache in bytes allocated to a gateway. * @return Returns a reference to this object so that method calls can be chained together. */ Builder cacheAllocatedInBytes(Long 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. *

* * @param cacheUsedPercentage * 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 Returns a reference to this object so that method calls can be chained together. */ Builder cacheUsedPercentage(Double 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. *

* * @param cacheDirtyPercentage * 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 Returns a reference to this object so that method calls can be chained together. */ Builder cacheDirtyPercentage(Double 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. *

* * @param cacheHitPercentage * 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 Returns a reference to this object so that method calls can be chained together. */ Builder cacheHitPercentage(Double 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. *

* * @param cacheMissPercentage * 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 Returns a reference to this object so that method calls can be chained together. */ Builder cacheMissPercentage(Double cacheMissPercentage); } static final class BuilderImpl extends StorageGatewayResponse.BuilderImpl implements Builder { private String gatewayARN; private List diskIds = DefaultSdkAutoConstructList.getInstance(); private Long cacheAllocatedInBytes; private Double cacheUsedPercentage; private Double cacheDirtyPercentage; private Double cacheHitPercentage; private Double cacheMissPercentage; private BuilderImpl() { } private BuilderImpl(DescribeCacheResponse model) { super(model); gatewayARN(model.gatewayARN); diskIds(model.diskIds); cacheAllocatedInBytes(model.cacheAllocatedInBytes); cacheUsedPercentage(model.cacheUsedPercentage); cacheDirtyPercentage(model.cacheDirtyPercentage); cacheHitPercentage(model.cacheHitPercentage); cacheMissPercentage(model.cacheMissPercentage); } public final String getGatewayARN() { return gatewayARN; } @Override public final Builder gatewayARN(String gatewayARN) { this.gatewayARN = gatewayARN; return this; } public final void setGatewayARN(String gatewayARN) { this.gatewayARN = gatewayARN; } public final Collection getDiskIds() { return diskIds; } @Override public final Builder diskIds(Collection diskIds) { this.diskIds = DiskIdsCopier.copy(diskIds); return this; } @Override @SafeVarargs public final Builder diskIds(String... diskIds) { diskIds(Arrays.asList(diskIds)); return this; } public final void setDiskIds(Collection diskIds) { this.diskIds = DiskIdsCopier.copy(diskIds); } public final Long getCacheAllocatedInBytes() { return cacheAllocatedInBytes; } @Override public final Builder cacheAllocatedInBytes(Long cacheAllocatedInBytes) { this.cacheAllocatedInBytes = cacheAllocatedInBytes; return this; } public final void setCacheAllocatedInBytes(Long cacheAllocatedInBytes) { this.cacheAllocatedInBytes = cacheAllocatedInBytes; } public final Double getCacheUsedPercentage() { return cacheUsedPercentage; } @Override public final Builder cacheUsedPercentage(Double cacheUsedPercentage) { this.cacheUsedPercentage = cacheUsedPercentage; return this; } public final void setCacheUsedPercentage(Double cacheUsedPercentage) { this.cacheUsedPercentage = cacheUsedPercentage; } public final Double getCacheDirtyPercentage() { return cacheDirtyPercentage; } @Override public final Builder cacheDirtyPercentage(Double cacheDirtyPercentage) { this.cacheDirtyPercentage = cacheDirtyPercentage; return this; } public final void setCacheDirtyPercentage(Double cacheDirtyPercentage) { this.cacheDirtyPercentage = cacheDirtyPercentage; } public final Double getCacheHitPercentage() { return cacheHitPercentage; } @Override public final Builder cacheHitPercentage(Double cacheHitPercentage) { this.cacheHitPercentage = cacheHitPercentage; return this; } public final void setCacheHitPercentage(Double cacheHitPercentage) { this.cacheHitPercentage = cacheHitPercentage; } public final Double getCacheMissPercentage() { return cacheMissPercentage; } @Override public final Builder cacheMissPercentage(Double cacheMissPercentage) { this.cacheMissPercentage = cacheMissPercentage; return this; } public final void setCacheMissPercentage(Double cacheMissPercentage) { this.cacheMissPercentage = cacheMissPercentage; } @Override public DescribeCacheResponse build() { return new DescribeCacheResponse(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy