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

com.azure.resourcemanager.azurestackhci.models.ExtensionInstanceView Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for AzureStackHci Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Stack HCI management service. Package tag package-2024-04.

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.azurestackhci.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;

/**
 * Describes the Extension Instance View.
 */
@Fluent
public final class ExtensionInstanceView implements JsonSerializable {
    /*
     * The extension name.
     */
    private String name;

    /*
     * Specifies the type of the extension; an example is "MicrosoftMonitoringAgent".
     */
    private String type;

    /*
     * Specifies the version of the script handler.
     */
    private String typeHandlerVersion;

    /*
     * Instance view status.
     */
    private ExtensionInstanceViewStatus status;

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

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

    /**
     * Set the name property: The extension name.
     * 
     * @param name the name value to set.
     * @return the ExtensionInstanceView object itself.
     */
    public ExtensionInstanceView withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the type property: Specifies the type of the extension; an example is "MicrosoftMonitoringAgent".
     * 
     * @return the type value.
     */
    public String type() {
        return this.type;
    }

    /**
     * Set the type property: Specifies the type of the extension; an example is "MicrosoftMonitoringAgent".
     * 
     * @param type the type value to set.
     * @return the ExtensionInstanceView object itself.
     */
    public ExtensionInstanceView withType(String type) {
        this.type = type;
        return this;
    }

    /**
     * Get the typeHandlerVersion property: Specifies the version of the script handler.
     * 
     * @return the typeHandlerVersion value.
     */
    public String typeHandlerVersion() {
        return this.typeHandlerVersion;
    }

    /**
     * Set the typeHandlerVersion property: Specifies the version of the script handler.
     * 
     * @param typeHandlerVersion the typeHandlerVersion value to set.
     * @return the ExtensionInstanceView object itself.
     */
    public ExtensionInstanceView withTypeHandlerVersion(String typeHandlerVersion) {
        this.typeHandlerVersion = typeHandlerVersion;
        return this;
    }

    /**
     * Get the status property: Instance view status.
     * 
     * @return the status value.
     */
    public ExtensionInstanceViewStatus status() {
        return this.status;
    }

    /**
     * Set the status property: Instance view status.
     * 
     * @param status the status value to set.
     * @return the ExtensionInstanceView object itself.
     */
    public ExtensionInstanceView withStatus(ExtensionInstanceViewStatus status) {
        this.status = status;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("name", this.name);
        jsonWriter.writeStringField("type", this.type);
        jsonWriter.writeStringField("typeHandlerVersion", this.typeHandlerVersion);
        jsonWriter.writeJsonField("status", this.status);
        return jsonWriter.writeEndObject();
    }

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

                if ("name".equals(fieldName)) {
                    deserializedExtensionInstanceView.name = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedExtensionInstanceView.type = reader.getString();
                } else if ("typeHandlerVersion".equals(fieldName)) {
                    deserializedExtensionInstanceView.typeHandlerVersion = reader.getString();
                } else if ("status".equals(fieldName)) {
                    deserializedExtensionInstanceView.status = ExtensionInstanceViewStatus.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedExtensionInstanceView;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy