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

com.azure.resourcemanager.elasticsan.models.IscsiTargetInfo 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.elasticsan.models;

import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
 * Iscsi target information.
 */
@Fluent
public final class IscsiTargetInfo implements JsonSerializable {
    /*
     * iSCSI Target IQN (iSCSI Qualified Name); example: "iqn.2005-03.org.iscsi:server".
     */
    private String targetIqn;

    /*
     * iSCSI Target Portal Host Name
     */
    private String targetPortalHostname;

    /*
     * iSCSI Target Portal Port
     */
    private Integer targetPortalPort;

    /*
     * State of the operation on the resource.
     */
    private ProvisioningStates provisioningState;

    /*
     * Operational status of the iSCSI Target.
     */
    private OperationalStatus status;

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

    /**
     * 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.targetIqn;
    }

    /**
     * Get the targetPortalHostname property: iSCSI Target Portal Host Name.
     * 
     * @return the targetPortalHostname value.
     */
    public String targetPortalHostname() {
        return this.targetPortalHostname;
    }

    /**
     * Get the targetPortalPort property: iSCSI Target Portal Port.
     * 
     * @return the targetPortalPort value.
     */
    public Integer targetPortalPort() {
        return this.targetPortalPort;
    }

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

    /**
     * Get the status property: Operational status of the iSCSI Target.
     * 
     * @return the status value.
     */
    public OperationalStatus status() {
        return this.status;
    }

    /**
     * Set the status property: Operational status of the iSCSI Target.
     * 
     * @param status the status value to set.
     * @return the IscsiTargetInfo object itself.
     */
    public IscsiTargetInfo withStatus(OperationalStatus status) {
        this.status = status;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString());
        return jsonWriter.writeEndObject();
    }

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

                if ("targetIqn".equals(fieldName)) {
                    deserializedIscsiTargetInfo.targetIqn = reader.getString();
                } else if ("targetPortalHostname".equals(fieldName)) {
                    deserializedIscsiTargetInfo.targetPortalHostname = reader.getString();
                } else if ("targetPortalPort".equals(fieldName)) {
                    deserializedIscsiTargetInfo.targetPortalPort = reader.getNullable(JsonReader::getInt);
                } else if ("provisioningState".equals(fieldName)) {
                    deserializedIscsiTargetInfo.provisioningState = ProvisioningStates.fromString(reader.getString());
                } else if ("status".equals(fieldName)) {
                    deserializedIscsiTargetInfo.status = OperationalStatus.fromString(reader.getString());
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedIscsiTargetInfo;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy