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

com.azure.resourcemanager.automation.models.DscNodeUpdateParameters 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.automation.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;

/**
 * The parameters supplied to the update dsc node operation.
 */
@Fluent
public final class DscNodeUpdateParameters implements JsonSerializable {
    /*
     * Gets or sets the id of the dsc node.
     */
    private String nodeId;

    /*
     * The properties property.
     */
    private DscNodeUpdateParametersProperties properties;

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

    /**
     * Get the nodeId property: Gets or sets the id of the dsc node.
     * 
     * @return the nodeId value.
     */
    public String nodeId() {
        return this.nodeId;
    }

    /**
     * Set the nodeId property: Gets or sets the id of the dsc node.
     * 
     * @param nodeId the nodeId value to set.
     * @return the DscNodeUpdateParameters object itself.
     */
    public DscNodeUpdateParameters withNodeId(String nodeId) {
        this.nodeId = nodeId;
        return this;
    }

    /**
     * Get the properties property: The properties property.
     * 
     * @return the properties value.
     */
    public DscNodeUpdateParametersProperties properties() {
        return this.properties;
    }

    /**
     * Set the properties property: The properties property.
     * 
     * @param properties the properties value to set.
     * @return the DscNodeUpdateParameters object itself.
     */
    public DscNodeUpdateParameters withProperties(DscNodeUpdateParametersProperties properties) {
        this.properties = properties;
        return this;
    }

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

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

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

                if ("nodeId".equals(fieldName)) {
                    deserializedDscNodeUpdateParameters.nodeId = reader.getString();
                } else if ("properties".equals(fieldName)) {
                    deserializedDscNodeUpdateParameters.properties = DscNodeUpdateParametersProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDscNodeUpdateParameters;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy