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

com.azure.resourcemanager.storagepool.fluent.models.DiskPoolInner Maven / Gradle / Ivy

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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.storagepool.models.Disk;
import com.azure.resourcemanager.storagepool.models.OperationalStatus;
import com.azure.resourcemanager.storagepool.models.ProvisioningStates;
import com.azure.resourcemanager.storagepool.models.SystemMetadata;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * Response for Disk Pool request.
 */
@Fluent
public final class DiskPoolInner extends Resource {
    /*
     * Determines the SKU of the Disk pool
     */
    private Sku innerSku;

    /*
     * Properties of Disk Pool.
     */
    private DiskPoolProperties innerProperties = new DiskPoolProperties();

    /*
     * Azure resource id. Indicates if this resource is managed by another Azure resource.
     */
    private String managedBy;

    /*
     * List of Azure resource ids that manage this resource.
     */
    private List managedByExtended;

    /*
     * Resource metadata required by ARM RPC
     */
    private SystemMetadata systemData;

    /*
     * 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 DiskPoolInner class.
     */
    public DiskPoolInner() {
    }

    /**
     * Get the innerSku property: Determines the SKU of the Disk pool.
     * 
     * @return the innerSku value.
     */
    private Sku innerSku() {
        return this.innerSku;
    }

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

    /**
     * Get the managedBy property: Azure resource id. Indicates if this resource is managed by another Azure resource.
     * 
     * @return the managedBy value.
     */
    public String managedBy() {
        return this.managedBy;
    }

    /**
     * Get the managedByExtended property: List of Azure resource ids that manage this resource.
     * 
     * @return the managedByExtended value.
     */
    public List managedByExtended() {
        return this.managedByExtended;
    }

    /**
     * Get the systemData property: Resource metadata required by ARM RPC.
     * 
     * @return the systemData value.
     */
    public SystemMetadata systemData() {
        return this.systemData;
    }

    /**
     * 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 DiskPoolInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

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

    /**
     * Get the name property: Sku name.
     * 
     * @return the name value.
     */
    public String nameSkuName() {
        return this.innerSku() == null ? null : this.innerSku().name();
    }

    /**
     * Set the name property: Sku name.
     * 
     * @param name the name value to set.
     * @return the DiskPoolInner object itself.
     */
    public DiskPoolInner withNameSkuName(String name) {
        if (this.innerSku() == null) {
            this.innerSku = new Sku();
        }
        this.innerSku().withName(name);
        return this;
    }

    /**
     * Get the tier property: Sku tier.
     * 
     * @return the tier value.
     */
    public String tier() {
        return this.innerSku() == null ? null : this.innerSku().tier();
    }

    /**
     * Set the tier property: Sku tier.
     * 
     * @param tier the tier value to set.
     * @return the DiskPoolInner object itself.
     */
    public DiskPoolInner withTier(String tier) {
        if (this.innerSku() == null) {
            this.innerSku = new Sku();
        }
        this.innerSku().withTier(tier);
        return this;
    }

    /**
     * Get the provisioningState property: State of the operation on the resource.
     * 
     * @return the provisioningState value.
     */
    public ProvisioningStates provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the availabilityZones property: Logical zone for Disk Pool resource; example: ["1"].
     * 
     * @return the availabilityZones value.
     */
    public List availabilityZones() {
        return this.innerProperties() == null ? null : this.innerProperties().availabilityZones();
    }

    /**
     * Set the availabilityZones property: Logical zone for Disk Pool resource; example: ["1"].
     * 
     * @param availabilityZones the availabilityZones value to set.
     * @return the DiskPoolInner object itself.
     */
    public DiskPoolInner withAvailabilityZones(List availabilityZones) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DiskPoolProperties();
        }
        this.innerProperties().withAvailabilityZones(availabilityZones);
        return this;
    }

    /**
     * Get the status property: Operational status of the Disk Pool.
     * 
     * @return the status value.
     */
    public OperationalStatus status() {
        return this.innerProperties() == null ? null : this.innerProperties().status();
    }

    /**
     * Set the status property: Operational status of the Disk Pool.
     * 
     * @param status the status value to set.
     * @return the DiskPoolInner object itself.
     */
    public DiskPoolInner withStatus(OperationalStatus status) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DiskPoolProperties();
        }
        this.innerProperties().withStatus(status);
        return this;
    }

    /**
     * Get the disks property: List of Azure Managed Disks to attach to a Disk Pool.
     * 
     * @return the disks value.
     */
    public List disks() {
        return this.innerProperties() == null ? null : this.innerProperties().disks();
    }

    /**
     * Set the disks property: List of Azure Managed Disks to attach to a Disk Pool.
     * 
     * @param disks the disks value to set.
     * @return the DiskPoolInner object itself.
     */
    public DiskPoolInner withDisks(List disks) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DiskPoolProperties();
        }
        this.innerProperties().withDisks(disks);
        return this;
    }

    /**
     * Get the subnetId property: Azure Resource ID of a Subnet for the Disk Pool.
     * 
     * @return the subnetId value.
     */
    public String subnetId() {
        return this.innerProperties() == null ? null : this.innerProperties().subnetId();
    }

    /**
     * Set the subnetId property: Azure Resource ID of a Subnet for the Disk Pool.
     * 
     * @param subnetId the subnetId value to set.
     * @return the DiskPoolInner object itself.
     */
    public DiskPoolInner withSubnetId(String subnetId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DiskPoolProperties();
        }
        this.innerProperties().withSubnetId(subnetId);
        return this;
    }

    /**
     * Get the additionalCapabilities property: List of additional capabilities for Disk Pool.
     * 
     * @return the additionalCapabilities value.
     */
    public List additionalCapabilities() {
        return this.innerProperties() == null ? null : this.innerProperties().additionalCapabilities();
    }

    /**
     * Set the additionalCapabilities property: List of additional capabilities for Disk Pool.
     * 
     * @param additionalCapabilities the additionalCapabilities value to set.
     * @return the DiskPoolInner object itself.
     */
    public DiskPoolInner withAdditionalCapabilities(List additionalCapabilities) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DiskPoolProperties();
        }
        this.innerProperties().withAdditionalCapabilities(additionalCapabilities);
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerSku() != null) {
            innerSku().validate();
        }
        if (innerProperties() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException("Missing required property innerProperties in model DiskPoolInner"));
        } else {
            innerProperties().validate();
        }
        if (systemData() != null) {
            systemData().validate();
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(DiskPoolInner.class);

    /**
     * {@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("properties", this.innerProperties);
        jsonWriter.writeJsonField("sku", this.innerSku);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of DiskPoolInner from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of DiskPoolInner 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 DiskPoolInner.
     */
    public static DiskPoolInner fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            DiskPoolInner deserializedDiskPoolInner = new DiskPoolInner();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("id".equals(fieldName)) {
                    deserializedDiskPoolInner.id = reader.getString();
                } else if ("name".equals(fieldName)) {
                    deserializedDiskPoolInner.name = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedDiskPoolInner.type = reader.getString();
                } else if ("location".equals(fieldName)) {
                    deserializedDiskPoolInner.withLocation(reader.getString());
                } else if ("tags".equals(fieldName)) {
                    Map tags = reader.readMap(reader1 -> reader1.getString());
                    deserializedDiskPoolInner.withTags(tags);
                } else if ("properties".equals(fieldName)) {
                    deserializedDiskPoolInner.innerProperties = DiskPoolProperties.fromJson(reader);
                } else if ("sku".equals(fieldName)) {
                    deserializedDiskPoolInner.innerSku = Sku.fromJson(reader);
                } else if ("managedBy".equals(fieldName)) {
                    deserializedDiskPoolInner.managedBy = reader.getString();
                } else if ("managedByExtended".equals(fieldName)) {
                    List managedByExtended = reader.readArray(reader1 -> reader1.getString());
                    deserializedDiskPoolInner.managedByExtended = managedByExtended;
                } else if ("systemData".equals(fieldName)) {
                    deserializedDiskPoolInner.systemData = SystemMetadata.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDiskPoolInner;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy