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

com.azure.resourcemanager.automation.fluent.models.GraphicalRunbookContentInner Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for Automation Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Automation Client. Package tag package-2022-02-22.

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.automation.fluent.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 com.azure.resourcemanager.automation.models.RawGraphicalRunbookContent;
import java.io.IOException;

/**
 * Graphical Runbook Content.
 */
@Fluent
public final class GraphicalRunbookContentInner implements JsonSerializable {
    /*
     * Raw graphical Runbook content.
     */
    private RawGraphicalRunbookContent rawContent;

    /*
     * Graphical Runbook content as JSON
     */
    private String graphRunbookJson;

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

    /**
     * Get the rawContent property: Raw graphical Runbook content.
     * 
     * @return the rawContent value.
     */
    public RawGraphicalRunbookContent rawContent() {
        return this.rawContent;
    }

    /**
     * Set the rawContent property: Raw graphical Runbook content.
     * 
     * @param rawContent the rawContent value to set.
     * @return the GraphicalRunbookContentInner object itself.
     */
    public GraphicalRunbookContentInner withRawContent(RawGraphicalRunbookContent rawContent) {
        this.rawContent = rawContent;
        return this;
    }

    /**
     * Get the graphRunbookJson property: Graphical Runbook content as JSON.
     * 
     * @return the graphRunbookJson value.
     */
    public String graphRunbookJson() {
        return this.graphRunbookJson;
    }

    /**
     * Set the graphRunbookJson property: Graphical Runbook content as JSON.
     * 
     * @param graphRunbookJson the graphRunbookJson value to set.
     * @return the GraphicalRunbookContentInner object itself.
     */
    public GraphicalRunbookContentInner withGraphRunbookJson(String graphRunbookJson) {
        this.graphRunbookJson = graphRunbookJson;
        return this;
    }

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

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

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

                if ("rawContent".equals(fieldName)) {
                    deserializedGraphicalRunbookContentInner.rawContent = RawGraphicalRunbookContent.fromJson(reader);
                } else if ("graphRunbookJson".equals(fieldName)) {
                    deserializedGraphicalRunbookContentInner.graphRunbookJson = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedGraphicalRunbookContentInner;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy