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

com.azure.resourcemanager.storagecache.fluent.models.CacheInner Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for StorageCache Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Managed Lustre provides a fully managed Lustre® file system, integrated with Blob storage, for use on demand. These operations create and manage Azure Managed Lustre file systems. Package tag package-2024-03.

The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.storagecache.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.management.SystemData;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.storagecache.models.CacheDirectorySettings;
import com.azure.resourcemanager.storagecache.models.CacheEncryptionSettings;
import com.azure.resourcemanager.storagecache.models.CacheHealth;
import com.azure.resourcemanager.storagecache.models.CacheIdentity;
import com.azure.resourcemanager.storagecache.models.CacheNetworkSettings;
import com.azure.resourcemanager.storagecache.models.CacheSecuritySettings;
import com.azure.resourcemanager.storagecache.models.CacheSku;
import com.azure.resourcemanager.storagecache.models.CacheUpgradeSettings;
import com.azure.resourcemanager.storagecache.models.CacheUpgradeStatus;
import com.azure.resourcemanager.storagecache.models.PrimingJob;
import com.azure.resourcemanager.storagecache.models.ProvisioningStateType;
import com.azure.resourcemanager.storagecache.models.StorageTargetSpaceAllocation;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * A cache instance. Follows Azure Resource Manager standards:
 * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md.
 */
@Fluent
public final class CacheInner extends Resource {
    /*
     * The identity of the cache, if configured.
     */
    private CacheIdentity identity;

    /*
     * The system meta data relating to this resource.
     */
    private SystemData systemData;

    /*
     * Properties of the cache.
     */
    private CacheProperties innerProperties;

    /*
     * SKU for the cache.
     */
    private CacheSku sku;

    /*
     * The type of the resource.
     */
    private String type;

    /*
     * The name of the resource.
     */
    private String name;

    /*
     * Fully qualified resource Id for the resource.
     */
    private String id;

    /**
     * Creates an instance of CacheInner class.
     */
    public CacheInner() {
    }

    /**
     * Get the identity property: The identity of the cache, if configured.
     * 
     * @return the identity value.
     */
    public CacheIdentity identity() {
        return this.identity;
    }

    /**
     * Set the identity property: The identity of the cache, if configured.
     * 
     * @param identity the identity value to set.
     * @return the CacheInner object itself.
     */
    public CacheInner withIdentity(CacheIdentity identity) {
        this.identity = identity;
        return this;
    }

    /**
     * Get the systemData property: The system meta data relating to this resource.
     * 
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

    /**
     * Get the innerProperties property: Properties of the cache.
     * 
     * @return the innerProperties value.
     */
    private CacheProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the sku property: SKU for the cache.
     * 
     * @return the sku value.
     */
    public CacheSku sku() {
        return this.sku;
    }

    /**
     * Set the sku property: SKU for the cache.
     * 
     * @param sku the sku value to set.
     * @return the CacheInner object itself.
     */
    public CacheInner withSku(CacheSku sku) {
        this.sku = sku;
        return this;
    }

    /**
     * Get the type property: The type of the resource.
     * 
     * @return the type value.
     */
    @Override
    public String type() {
        return this.type;
    }

    /**
     * Get the name property: The name of the resource.
     * 
     * @return the name value.
     */
    @Override
    public String name() {
        return this.name;
    }

    /**
     * Get the id property: Fully qualified resource Id for the resource.
     * 
     * @return the id value.
     */
    @Override
    public String id() {
        return this.id;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public CacheInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public CacheInner withTags(Map tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * Get the cacheSizeGB property: The size of this Cache, in GB.
     * 
     * @return the cacheSizeGB value.
     */
    public Integer cacheSizeGB() {
        return this.innerProperties() == null ? null : this.innerProperties().cacheSizeGB();
    }

    /**
     * Set the cacheSizeGB property: The size of this Cache, in GB.
     * 
     * @param cacheSizeGB the cacheSizeGB value to set.
     * @return the CacheInner object itself.
     */
    public CacheInner withCacheSizeGB(Integer cacheSizeGB) {
        if (this.innerProperties() == null) {
            this.innerProperties = new CacheProperties();
        }
        this.innerProperties().withCacheSizeGB(cacheSizeGB);
        return this;
    }

    /**
     * Get the health property: Health of the cache.
     * 
     * @return the health value.
     */
    public CacheHealth health() {
        return this.innerProperties() == null ? null : this.innerProperties().health();
    }

    /**
     * Get the mountAddresses property: Array of IPv4 addresses that can be used by clients mounting this cache.
     * 
     * @return the mountAddresses value.
     */
    public List mountAddresses() {
        return this.innerProperties() == null ? null : this.innerProperties().mountAddresses();
    }

    /**
     * Get the provisioningState property: ARM provisioning state, see
     * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property.
     * 
     * @return the provisioningState value.
     */
    public ProvisioningStateType provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the subnet property: Subnet used for the cache.
     * 
     * @return the subnet value.
     */
    public String subnet() {
        return this.innerProperties() == null ? null : this.innerProperties().subnet();
    }

    /**
     * Set the subnet property: Subnet used for the cache.
     * 
     * @param subnet the subnet value to set.
     * @return the CacheInner object itself.
     */
    public CacheInner withSubnet(String subnet) {
        if (this.innerProperties() == null) {
            this.innerProperties = new CacheProperties();
        }
        this.innerProperties().withSubnet(subnet);
        return this;
    }

    /**
     * Get the upgradeStatus property: Upgrade status of the cache.
     * 
     * @return the upgradeStatus value.
     */
    public CacheUpgradeStatus upgradeStatus() {
        return this.innerProperties() == null ? null : this.innerProperties().upgradeStatus();
    }

    /**
     * Get the upgradeSettings property: Upgrade settings of the cache.
     * 
     * @return the upgradeSettings value.
     */
    public CacheUpgradeSettings upgradeSettings() {
        return this.innerProperties() == null ? null : this.innerProperties().upgradeSettings();
    }

    /**
     * Set the upgradeSettings property: Upgrade settings of the cache.
     * 
     * @param upgradeSettings the upgradeSettings value to set.
     * @return the CacheInner object itself.
     */
    public CacheInner withUpgradeSettings(CacheUpgradeSettings upgradeSettings) {
        if (this.innerProperties() == null) {
            this.innerProperties = new CacheProperties();
        }
        this.innerProperties().withUpgradeSettings(upgradeSettings);
        return this;
    }

    /**
     * Get the networkSettings property: Specifies network settings of the cache.
     * 
     * @return the networkSettings value.
     */
    public CacheNetworkSettings networkSettings() {
        return this.innerProperties() == null ? null : this.innerProperties().networkSettings();
    }

    /**
     * Set the networkSettings property: Specifies network settings of the cache.
     * 
     * @param networkSettings the networkSettings value to set.
     * @return the CacheInner object itself.
     */
    public CacheInner withNetworkSettings(CacheNetworkSettings networkSettings) {
        if (this.innerProperties() == null) {
            this.innerProperties = new CacheProperties();
        }
        this.innerProperties().withNetworkSettings(networkSettings);
        return this;
    }

    /**
     * Get the encryptionSettings property: Specifies encryption settings of the cache.
     * 
     * @return the encryptionSettings value.
     */
    public CacheEncryptionSettings encryptionSettings() {
        return this.innerProperties() == null ? null : this.innerProperties().encryptionSettings();
    }

    /**
     * Set the encryptionSettings property: Specifies encryption settings of the cache.
     * 
     * @param encryptionSettings the encryptionSettings value to set.
     * @return the CacheInner object itself.
     */
    public CacheInner withEncryptionSettings(CacheEncryptionSettings encryptionSettings) {
        if (this.innerProperties() == null) {
            this.innerProperties = new CacheProperties();
        }
        this.innerProperties().withEncryptionSettings(encryptionSettings);
        return this;
    }

    /**
     * Get the securitySettings property: Specifies security settings of the cache.
     * 
     * @return the securitySettings value.
     */
    public CacheSecuritySettings securitySettings() {
        return this.innerProperties() == null ? null : this.innerProperties().securitySettings();
    }

    /**
     * Set the securitySettings property: Specifies security settings of the cache.
     * 
     * @param securitySettings the securitySettings value to set.
     * @return the CacheInner object itself.
     */
    public CacheInner withSecuritySettings(CacheSecuritySettings securitySettings) {
        if (this.innerProperties() == null) {
            this.innerProperties = new CacheProperties();
        }
        this.innerProperties().withSecuritySettings(securitySettings);
        return this;
    }

    /**
     * Get the directoryServicesSettings property: Specifies Directory Services settings of the cache.
     * 
     * @return the directoryServicesSettings value.
     */
    public CacheDirectorySettings directoryServicesSettings() {
        return this.innerProperties() == null ? null : this.innerProperties().directoryServicesSettings();
    }

    /**
     * Set the directoryServicesSettings property: Specifies Directory Services settings of the cache.
     * 
     * @param directoryServicesSettings the directoryServicesSettings value to set.
     * @return the CacheInner object itself.
     */
    public CacheInner withDirectoryServicesSettings(CacheDirectorySettings directoryServicesSettings) {
        if (this.innerProperties() == null) {
            this.innerProperties = new CacheProperties();
        }
        this.innerProperties().withDirectoryServicesSettings(directoryServicesSettings);
        return this;
    }

    /**
     * Get the zones property: Availability zones for resources. This field should only contain a single element in the
     * array.
     * 
     * @return the zones value.
     */
    public List zones() {
        return this.innerProperties() == null ? null : this.innerProperties().zones();
    }

    /**
     * Set the zones property: Availability zones for resources. This field should only contain a single element in the
     * array.
     * 
     * @param zones the zones value to set.
     * @return the CacheInner object itself.
     */
    public CacheInner withZones(List zones) {
        if (this.innerProperties() == null) {
            this.innerProperties = new CacheProperties();
        }
        this.innerProperties().withZones(zones);
        return this;
    }

    /**
     * Get the primingJobs property: Specifies the priming jobs defined in the cache.
     * 
     * @return the primingJobs value.
     */
    public List primingJobs() {
        return this.innerProperties() == null ? null : this.innerProperties().primingJobs();
    }

    /**
     * Get the spaceAllocation property: Specifies the space allocation percentage for each storage target in the cache.
     * 
     * @return the spaceAllocation value.
     */
    public List spaceAllocation() {
        return this.innerProperties() == null ? null : this.innerProperties().spaceAllocation();
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (identity() != null) {
            identity().validate();
        }
        if (innerProperties() != null) {
            innerProperties().validate();
        }
        if (sku() != null) {
            sku().validate();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("location", location());
        jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element));
        jsonWriter.writeJsonField("identity", this.identity);
        jsonWriter.writeJsonField("properties", this.innerProperties);
        jsonWriter.writeJsonField("sku", this.sku);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of CacheInner from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of CacheInner if the JsonReader was pointing to an instance of it, or null if it was pointing
     * to JSON null.
     * @throws IllegalStateException If the deserialized JSON object was missing any required properties.
     * @throws IOException If an error occurs while reading the CacheInner.
     */
    public static CacheInner fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            CacheInner deserializedCacheInner = new CacheInner();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("id".equals(fieldName)) {
                    deserializedCacheInner.id = reader.getString();
                } else if ("name".equals(fieldName)) {
                    deserializedCacheInner.name = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedCacheInner.type = reader.getString();
                } else if ("location".equals(fieldName)) {
                    deserializedCacheInner.withLocation(reader.getString());
                } else if ("tags".equals(fieldName)) {
                    Map tags = reader.readMap(reader1 -> reader1.getString());
                    deserializedCacheInner.withTags(tags);
                } else if ("identity".equals(fieldName)) {
                    deserializedCacheInner.identity = CacheIdentity.fromJson(reader);
                } else if ("systemData".equals(fieldName)) {
                    deserializedCacheInner.systemData = SystemData.fromJson(reader);
                } else if ("properties".equals(fieldName)) {
                    deserializedCacheInner.innerProperties = CacheProperties.fromJson(reader);
                } else if ("sku".equals(fieldName)) {
                    deserializedCacheInner.sku = CacheSku.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedCacheInner;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy