com.azure.resourcemanager.avs.models.ScriptStringExecutionParameter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-avs Show documentation
Show all versions of azure-resourcemanager-avs Show documentation
This package contains Microsoft Azure SDK for Avs Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure VMware Solution API. Package tag package-2023-09-01.
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.avs.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* a plain text value execution parameter.
*/
@Fluent
public final class ScriptStringExecutionParameter extends ScriptExecutionParameter {
/*
* script execution parameter type
*/
private ScriptExecutionParameterType type = ScriptExecutionParameterType.VALUE;
/*
* The value for the passed parameter
*/
private String value;
/**
* Creates an instance of ScriptStringExecutionParameter class.
*/
public ScriptStringExecutionParameter() {
}
/**
* Get the type property: script execution parameter type.
*
* @return the type value.
*/
@Override
public ScriptExecutionParameterType type() {
return this.type;
}
/**
* Get the value property: The value for the passed parameter.
*
* @return the value value.
*/
public String value() {
return this.value;
}
/**
* Set the value property: The value for the passed parameter.
*
* @param value the value value to set.
* @return the ScriptStringExecutionParameter object itself.
*/
public ScriptStringExecutionParameter withValue(String value) {
this.value = value;
return this;
}
/**
* {@inheritDoc}
*/
@Override
public ScriptStringExecutionParameter withName(String name) {
super.withName(name);
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
@Override
public void validate() {
if (name() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property name in model ScriptStringExecutionParameter"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(ScriptStringExecutionParameter.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("name", name());
jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString());
jsonWriter.writeStringField("value", this.value);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of ScriptStringExecutionParameter from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of ScriptStringExecutionParameter 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 ScriptStringExecutionParameter.
*/
public static ScriptStringExecutionParameter fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
ScriptStringExecutionParameter deserializedScriptStringExecutionParameter
= new ScriptStringExecutionParameter();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("name".equals(fieldName)) {
deserializedScriptStringExecutionParameter.withName(reader.getString());
} else if ("type".equals(fieldName)) {
deserializedScriptStringExecutionParameter.type
= ScriptExecutionParameterType.fromString(reader.getString());
} else if ("value".equals(fieldName)) {
deserializedScriptStringExecutionParameter.value = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedScriptStringExecutionParameter;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy