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

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

/**
 * The properties of the update connection operation.
 */
@Fluent
public final class ConnectionUpdateProperties implements JsonSerializable {
    /*
     * Gets or sets the description of the connection.
     */
    private String description;

    /*
     * Gets or sets the field definition values of the connection.
     */
    private Map fieldDefinitionValues;

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

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

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

    /**
     * Set the fieldDefinitionValues property: Gets or sets the field definition values of the connection.
     * 
     * @param fieldDefinitionValues the fieldDefinitionValues value to set.
     * @return the ConnectionUpdateProperties object itself.
     */
    public ConnectionUpdateProperties withFieldDefinitionValues(Map fieldDefinitionValues) {
        this.fieldDefinitionValues = fieldDefinitionValues;
        return this;
    }

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

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

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

                if ("description".equals(fieldName)) {
                    deserializedConnectionUpdateProperties.description = reader.getString();
                } else if ("fieldDefinitionValues".equals(fieldName)) {
                    Map fieldDefinitionValues = reader.readMap(reader1 -> reader1.getString());
                    deserializedConnectionUpdateProperties.fieldDefinitionValues = fieldDefinitionValues;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedConnectionUpdateProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy