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

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

/**
 * The parameters supplied to the create or update node configuration operation.
 */
@Fluent
public final class DscNodeConfigurationCreateOrUpdateParameters
    implements JsonSerializable {
    /*
     * Node configuration properties
     */
    private DscNodeConfigurationCreateOrUpdateParametersProperties innerProperties;

    /*
     * Name of the node configuration.
     */
    private String name;

    /*
     * Gets or sets the tags attached to the resource.
     */
    private Map tags;

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

    /**
     * Get the innerProperties property: Node configuration properties.
     * 
     * @return the innerProperties value.
     */
    private DscNodeConfigurationCreateOrUpdateParametersProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the name property: Name of the node configuration.
     * 
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Set the name property: Name of the node configuration.
     * 
     * @param name the name value to set.
     * @return the DscNodeConfigurationCreateOrUpdateParameters object itself.
     */
    public DscNodeConfigurationCreateOrUpdateParameters withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the tags property: Gets or sets the tags attached to the resource.
     * 
     * @return the tags value.
     */
    public Map tags() {
        return this.tags;
    }

    /**
     * Set the tags property: Gets or sets the tags attached to the resource.
     * 
     * @param tags the tags value to set.
     * @return the DscNodeConfigurationCreateOrUpdateParameters object itself.
     */
    public DscNodeConfigurationCreateOrUpdateParameters withTags(Map tags) {
        this.tags = tags;
        return this;
    }

    /**
     * Get the source property: Gets or sets the source.
     * 
     * @return the source value.
     */
    public ContentSource source() {
        return this.innerProperties() == null ? null : this.innerProperties().source();
    }

    /**
     * Set the source property: Gets or sets the source.
     * 
     * @param source the source value to set.
     * @return the DscNodeConfigurationCreateOrUpdateParameters object itself.
     */
    public DscNodeConfigurationCreateOrUpdateParameters withSource(ContentSource source) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DscNodeConfigurationCreateOrUpdateParametersProperties();
        }
        this.innerProperties().withSource(source);
        return this;
    }

    /**
     * Get the configuration property: Gets or sets the configuration of the node.
     * 
     * @return the configuration value.
     */
    public DscConfigurationAssociationProperty configuration() {
        return this.innerProperties() == null ? null : this.innerProperties().configuration();
    }

    /**
     * Set the configuration property: Gets or sets the configuration of the node.
     * 
     * @param configuration the configuration value to set.
     * @return the DscNodeConfigurationCreateOrUpdateParameters object itself.
     */
    public DscNodeConfigurationCreateOrUpdateParameters
        withConfiguration(DscConfigurationAssociationProperty configuration) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DscNodeConfigurationCreateOrUpdateParametersProperties();
        }
        this.innerProperties().withConfiguration(configuration);
        return this;
    }

    /**
     * Get the incrementNodeConfigurationBuild property: If a new build version of NodeConfiguration is required.
     * 
     * @return the incrementNodeConfigurationBuild value.
     */
    public Boolean incrementNodeConfigurationBuild() {
        return this.innerProperties() == null ? null : this.innerProperties().incrementNodeConfigurationBuild();
    }

    /**
     * Set the incrementNodeConfigurationBuild property: If a new build version of NodeConfiguration is required.
     * 
     * @param incrementNodeConfigurationBuild the incrementNodeConfigurationBuild value to set.
     * @return the DscNodeConfigurationCreateOrUpdateParameters object itself.
     */
    public DscNodeConfigurationCreateOrUpdateParameters
        withIncrementNodeConfigurationBuild(Boolean incrementNodeConfigurationBuild) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DscNodeConfigurationCreateOrUpdateParametersProperties();
        }
        this.innerProperties().withIncrementNodeConfigurationBuild(incrementNodeConfigurationBuild);
        return this;
    }

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

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

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

                if ("properties".equals(fieldName)) {
                    deserializedDscNodeConfigurationCreateOrUpdateParameters.innerProperties
                        = DscNodeConfigurationCreateOrUpdateParametersProperties.fromJson(reader);
                } else if ("name".equals(fieldName)) {
                    deserializedDscNodeConfigurationCreateOrUpdateParameters.name = reader.getString();
                } else if ("tags".equals(fieldName)) {
                    Map tags = reader.readMap(reader1 -> reader1.getString());
                    deserializedDscNodeConfigurationCreateOrUpdateParameters.tags = tags;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDscNodeConfigurationCreateOrUpdateParameters;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy