
com.azure.resourcemanager.automation.models.VariableUpdateParameters 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 com.azure.resourcemanager.automation.fluent.models.VariableUpdateProperties;
import java.io.IOException;
/**
* The parameters supplied to the update variable operation.
*/
@Fluent
public final class VariableUpdateParameters implements JsonSerializable {
/*
* Gets or sets the name of the variable.
*/
private String name;
/*
* Gets or sets the value of the variable.
*/
private VariableUpdateProperties innerProperties;
/**
* Creates an instance of VariableUpdateParameters class.
*/
public VariableUpdateParameters() {
}
/**
* Get the name property: Gets or sets the name of the variable.
*
* @return the name value.
*/
public String name() {
return this.name;
}
/**
* Set the name property: Gets or sets the name of the variable.
*
* @param name the name value to set.
* @return the VariableUpdateParameters object itself.
*/
public VariableUpdateParameters withName(String name) {
this.name = name;
return this;
}
/**
* Get the innerProperties property: Gets or sets the value of the variable.
*
* @return the innerProperties value.
*/
private VariableUpdateProperties innerProperties() {
return this.innerProperties;
}
/**
* Get the value property: Gets or sets the value of the variable.
*
* @return the value value.
*/
public String value() {
return this.innerProperties() == null ? null : this.innerProperties().value();
}
/**
* Set the value property: Gets or sets the value of the variable.
*
* @param value the value value to set.
* @return the VariableUpdateParameters object itself.
*/
public VariableUpdateParameters withValue(String value) {
if (this.innerProperties() == null) {
this.innerProperties = new VariableUpdateProperties();
}
this.innerProperties().withValue(value);
return this;
}
/**
* Get the description property: Gets or sets the description of the variable.
*
* @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 variable.
*
* @param description the description value to set.
* @return the VariableUpdateParameters object itself.
*/
public VariableUpdateParameters withDescription(String description) {
if (this.innerProperties() == null) {
this.innerProperties = new VariableUpdateProperties();
}
this.innerProperties().withDescription(description);
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 VariableUpdateParameters from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of VariableUpdateParameters 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 VariableUpdateParameters.
*/
public static VariableUpdateParameters fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
VariableUpdateParameters deserializedVariableUpdateParameters = new VariableUpdateParameters();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("name".equals(fieldName)) {
deserializedVariableUpdateParameters.name = reader.getString();
} else if ("properties".equals(fieldName)) {
deserializedVariableUpdateParameters.innerProperties = VariableUpdateProperties.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedVariableUpdateParameters;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy