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

com.azure.resourcemanager.automation.models.DscConfigurationCreateOrUpdateParameters 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.core.util.logging.ClientLogger;
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.DscConfigurationCreateOrUpdateProperties;
import java.io.IOException;
import java.util.Map;

/**
 * The parameters supplied to the create or update configuration operation.
 */
@Fluent
public final class DscConfigurationCreateOrUpdateParameters
    implements JsonSerializable {
    /*
     * Gets or sets configuration create or update properties.
     */
    private DscConfigurationCreateOrUpdateProperties innerProperties = new DscConfigurationCreateOrUpdateProperties();

    /*
     * Gets or sets name of the resource.
     */
    private String name;

    /*
     * Gets or sets the location of the resource.
     */
    private String location;

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

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

    /**
     * Get the innerProperties property: Gets or sets configuration create or update properties.
     * 
     * @return the innerProperties value.
     */
    private DscConfigurationCreateOrUpdateProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the name property: Gets or sets name of the resource.
     * 
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Set the name property: Gets or sets name of the resource.
     * 
     * @param name the name value to set.
     * @return the DscConfigurationCreateOrUpdateParameters object itself.
     */
    public DscConfigurationCreateOrUpdateParameters withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the location property: Gets or sets the location of the resource.
     * 
     * @return the location value.
     */
    public String location() {
        return this.location;
    }

    /**
     * Set the location property: Gets or sets the location of the resource.
     * 
     * @param location the location value to set.
     * @return the DscConfigurationCreateOrUpdateParameters object itself.
     */
    public DscConfigurationCreateOrUpdateParameters withLocation(String location) {
        this.location = location;
        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 DscConfigurationCreateOrUpdateParameters object itself.
     */
    public DscConfigurationCreateOrUpdateParameters withTags(Map tags) {
        this.tags = tags;
        return this;
    }

    /**
     * Get the logVerbose property: Gets or sets verbose log option.
     * 
     * @return the logVerbose value.
     */
    public Boolean logVerbose() {
        return this.innerProperties() == null ? null : this.innerProperties().logVerbose();
    }

    /**
     * Set the logVerbose property: Gets or sets verbose log option.
     * 
     * @param logVerbose the logVerbose value to set.
     * @return the DscConfigurationCreateOrUpdateParameters object itself.
     */
    public DscConfigurationCreateOrUpdateParameters withLogVerbose(Boolean logVerbose) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DscConfigurationCreateOrUpdateProperties();
        }
        this.innerProperties().withLogVerbose(logVerbose);
        return this;
    }

    /**
     * Get the logProgress property: Gets or sets progress log option.
     * 
     * @return the logProgress value.
     */
    public Boolean logProgress() {
        return this.innerProperties() == null ? null : this.innerProperties().logProgress();
    }

    /**
     * Set the logProgress property: Gets or sets progress log option.
     * 
     * @param logProgress the logProgress value to set.
     * @return the DscConfigurationCreateOrUpdateParameters object itself.
     */
    public DscConfigurationCreateOrUpdateParameters withLogProgress(Boolean logProgress) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DscConfigurationCreateOrUpdateProperties();
        }
        this.innerProperties().withLogProgress(logProgress);
        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 DscConfigurationCreateOrUpdateParameters object itself.
     */
    public DscConfigurationCreateOrUpdateParameters withSource(ContentSource source) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DscConfigurationCreateOrUpdateProperties();
        }
        this.innerProperties().withSource(source);
        return this;
    }

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

    /**
     * Set the parameters property: Gets or sets the configuration parameters.
     * 
     * @param parameters the parameters value to set.
     * @return the DscConfigurationCreateOrUpdateParameters object itself.
     */
    public DscConfigurationCreateOrUpdateParameters withParameters(Map parameters) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DscConfigurationCreateOrUpdateProperties();
        }
        this.innerProperties().withParameters(parameters);
        return this;
    }

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

    /**
     * Set the description property: Gets or sets the description of the configuration.
     * 
     * @param description the description value to set.
     * @return the DscConfigurationCreateOrUpdateParameters object itself.
     */
    public DscConfigurationCreateOrUpdateParameters withDescription(String description) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DscConfigurationCreateOrUpdateProperties();
        }
        this.innerProperties().withDescription(description);
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerProperties() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException(
                    "Missing required property innerProperties in model DscConfigurationCreateOrUpdateParameters"));
        } else {
            innerProperties().validate();
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(DscConfigurationCreateOrUpdateParameters.class);

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

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

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

            return deserializedDscConfigurationCreateOrUpdateParameters;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy