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

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

/**
 * The parameters supplied to the update connection operation.
 */
@Fluent
public final class ConnectionUpdateParameters implements JsonSerializable {
    /*
     * Gets or sets the name of the connection.
     */
    private String name;

    /*
     * Gets or sets the properties of the connection.
     */
    private ConnectionUpdateProperties innerProperties;

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

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

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

    /**
     * Get the innerProperties property: Gets or sets the properties of the connection.
     * 
     * @return the innerProperties value.
     */
    private ConnectionUpdateProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the description property: Gets or sets the description of the connection.
     * 
     * @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 connection.
     * 
     * @param description the description value to set.
     * @return the ConnectionUpdateParameters object itself.
     */
    public ConnectionUpdateParameters withDescription(String description) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ConnectionUpdateProperties();
        }
        this.innerProperties().withDescription(description);
        return this;
    }

    /**
     * Get the fieldDefinitionValues property: Gets or sets the field definition values of the connection.
     * 
     * @return the fieldDefinitionValues value.
     */
    public Map fieldDefinitionValues() {
        return this.innerProperties() == null ? null : this.innerProperties().fieldDefinitionValues();
    }

    /**
     * Set the fieldDefinitionValues property: Gets or sets the field definition values of the connection.
     * 
     * @param fieldDefinitionValues the fieldDefinitionValues value to set.
     * @return the ConnectionUpdateParameters object itself.
     */
    public ConnectionUpdateParameters withFieldDefinitionValues(Map fieldDefinitionValues) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ConnectionUpdateProperties();
        }
        this.innerProperties().withFieldDefinitionValues(fieldDefinitionValues);
        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.writeStringField("name", this.name);
        jsonWriter.writeJsonField("properties", this.innerProperties);
        return jsonWriter.writeEndObject();
    }

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

                if ("name".equals(fieldName)) {
                    deserializedConnectionUpdateParameters.name = reader.getString();
                } else if ("properties".equals(fieldName)) {
                    deserializedConnectionUpdateParameters.innerProperties
                        = ConnectionUpdateProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedConnectionUpdateParameters;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy