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

com.azure.resourcemanager.storagepool.models.IscsiTargetCreate 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.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
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.fluent.models.IscsiTargetCreateProperties;
import java.io.IOException;
import java.util.List;

/**
 * Payload for iSCSI Target create or update requests.
 */
@Fluent
public final class IscsiTargetCreate extends ProxyResource {
    /*
     * Properties for iSCSI Target create request.
     */
    private IscsiTargetCreateProperties innerProperties = new IscsiTargetCreateProperties();

    /*
     * 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;

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

    /**
     * Get the innerProperties property: Properties for iSCSI Target create request.
     * 
     * @return the innerProperties value.
     */
    private IscsiTargetCreateProperties 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;
    }

    /**
     * Set the managedBy property: Azure resource id. Indicates if this resource is managed by another Azure resource.
     * 
     * @param managedBy the managedBy value to set.
     * @return the IscsiTargetCreate object itself.
     */
    public IscsiTargetCreate withManagedBy(String managedBy) {
        this.managedBy = managedBy;
        return this;
    }

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

    /**
     * Set the managedByExtended property: List of Azure resource ids that manage this resource.
     * 
     * @param managedByExtended the managedByExtended value to set.
     * @return the IscsiTargetCreate object itself.
     */
    public IscsiTargetCreate withManagedByExtended(List managedByExtended) {
        this.managedByExtended = managedByExtended;
        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;
    }

    /**
     * Get the aclMode property: Mode for Target connectivity.
     * 
     * @return the aclMode value.
     */
    public IscsiTargetAclMode aclMode() {
        return this.innerProperties() == null ? null : this.innerProperties().aclMode();
    }

    /**
     * Set the aclMode property: Mode for Target connectivity.
     * 
     * @param aclMode the aclMode value to set.
     * @return the IscsiTargetCreate object itself.
     */
    public IscsiTargetCreate withAclMode(IscsiTargetAclMode aclMode) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IscsiTargetCreateProperties();
        }
        this.innerProperties().withAclMode(aclMode);
        return this;
    }

    /**
     * Get the targetIqn property: iSCSI Target IQN (iSCSI Qualified Name); example: "iqn.2005-03.org.iscsi:server".
     * 
     * @return the targetIqn value.
     */
    public String targetIqn() {
        return this.innerProperties() == null ? null : this.innerProperties().targetIqn();
    }

    /**
     * Set the targetIqn property: iSCSI Target IQN (iSCSI Qualified Name); example: "iqn.2005-03.org.iscsi:server".
     * 
     * @param targetIqn the targetIqn value to set.
     * @return the IscsiTargetCreate object itself.
     */
    public IscsiTargetCreate withTargetIqn(String targetIqn) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IscsiTargetCreateProperties();
        }
        this.innerProperties().withTargetIqn(targetIqn);
        return this;
    }

    /**
     * Get the staticAcls property: Access Control List (ACL) for an iSCSI Target; defines LUN masking policy.
     * 
     * @return the staticAcls value.
     */
    public List staticAcls() {
        return this.innerProperties() == null ? null : this.innerProperties().staticAcls();
    }

    /**
     * Set the staticAcls property: Access Control List (ACL) for an iSCSI Target; defines LUN masking policy.
     * 
     * @param staticAcls the staticAcls value to set.
     * @return the IscsiTargetCreate object itself.
     */
    public IscsiTargetCreate withStaticAcls(List staticAcls) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IscsiTargetCreateProperties();
        }
        this.innerProperties().withStaticAcls(staticAcls);
        return this;
    }

    /**
     * Get the luns property: List of LUNs to be exposed through iSCSI Target.
     * 
     * @return the luns value.
     */
    public List luns() {
        return this.innerProperties() == null ? null : this.innerProperties().luns();
    }

    /**
     * Set the luns property: List of LUNs to be exposed through iSCSI Target.
     * 
     * @param luns the luns value to set.
     * @return the IscsiTargetCreate object itself.
     */
    public IscsiTargetCreate withLuns(List luns) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IscsiTargetCreateProperties();
        }
        this.innerProperties().withLuns(luns);
        return this;
    }

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

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

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

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

                if ("id".equals(fieldName)) {
                    deserializedIscsiTargetCreate.id = reader.getString();
                } else if ("name".equals(fieldName)) {
                    deserializedIscsiTargetCreate.name = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedIscsiTargetCreate.type = reader.getString();
                } else if ("properties".equals(fieldName)) {
                    deserializedIscsiTargetCreate.innerProperties = IscsiTargetCreateProperties.fromJson(reader);
                } else if ("managedBy".equals(fieldName)) {
                    deserializedIscsiTargetCreate.managedBy = reader.getString();
                } else if ("managedByExtended".equals(fieldName)) {
                    List managedByExtended = reader.readArray(reader1 -> reader1.getString());
                    deserializedIscsiTargetCreate.managedByExtended = managedByExtended;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedIscsiTargetCreate;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy