com.azure.resourcemanager.hdinsight.models.ScriptAction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-hdinsight Show documentation
Show all versions of azure-resourcemanager-hdinsight Show documentation
This package contains Microsoft Azure SDK for HDInsight Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. HDInsight Management Client. Package tag package-2024-08-preview.
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.hdinsight.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 java.io.IOException;
/**
* Describes a script action on role on the cluster.
*/
@Fluent
public final class ScriptAction implements JsonSerializable {
/*
* The name of the script action.
*/
private String name;
/*
* The URI to the script.
*/
private String uri;
/*
* The parameters for the script provided.
*/
private String parameters;
/**
* Creates an instance of ScriptAction class.
*/
public ScriptAction() {
}
/**
* Get the name property: The name of the script action.
*
* @return the name value.
*/
public String name() {
return this.name;
}
/**
* Set the name property: The name of the script action.
*
* @param name the name value to set.
* @return the ScriptAction object itself.
*/
public ScriptAction withName(String name) {
this.name = name;
return this;
}
/**
* Get the uri property: The URI to the script.
*
* @return the uri value.
*/
public String uri() {
return this.uri;
}
/**
* Set the uri property: The URI to the script.
*
* @param uri the uri value to set.
* @return the ScriptAction object itself.
*/
public ScriptAction withUri(String uri) {
this.uri = uri;
return this;
}
/**
* Get the parameters property: The parameters for the script provided.
*
* @return the parameters value.
*/
public String parameters() {
return this.parameters;
}
/**
* Set the parameters property: The parameters for the script provided.
*
* @param parameters the parameters value to set.
* @return the ScriptAction object itself.
*/
public ScriptAction withParameters(String parameters) {
this.parameters = parameters;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (name() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property name in model ScriptAction"));
}
if (uri() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property uri in model ScriptAction"));
}
if (parameters() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property parameters in model ScriptAction"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(ScriptAction.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("name", this.name);
jsonWriter.writeStringField("uri", this.uri);
jsonWriter.writeStringField("parameters", this.parameters);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of ScriptAction from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of ScriptAction 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 ScriptAction.
*/
public static ScriptAction fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
ScriptAction deserializedScriptAction = new ScriptAction();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("name".equals(fieldName)) {
deserializedScriptAction.name = reader.getString();
} else if ("uri".equals(fieldName)) {
deserializedScriptAction.uri = reader.getString();
} else if ("parameters".equals(fieldName)) {
deserializedScriptAction.parameters = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedScriptAction;
});
}
}