com.azure.resourcemanager.hdinsight.models.ExecuteScriptActionParameters 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.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.List;
/**
* The parameters for the script actions to execute on a running cluster.
*/
@Fluent
public final class ExecuteScriptActionParameters implements JsonSerializable {
/*
* The list of run time script actions.
*/
private List scriptActions;
/*
* Gets or sets if the scripts needs to be persisted.
*/
private boolean persistOnSuccess;
/**
* Creates an instance of ExecuteScriptActionParameters class.
*/
public ExecuteScriptActionParameters() {
}
/**
* Get the scriptActions property: The list of run time script actions.
*
* @return the scriptActions value.
*/
public List scriptActions() {
return this.scriptActions;
}
/**
* Set the scriptActions property: The list of run time script actions.
*
* @param scriptActions the scriptActions value to set.
* @return the ExecuteScriptActionParameters object itself.
*/
public ExecuteScriptActionParameters withScriptActions(List scriptActions) {
this.scriptActions = scriptActions;
return this;
}
/**
* Get the persistOnSuccess property: Gets or sets if the scripts needs to be persisted.
*
* @return the persistOnSuccess value.
*/
public boolean persistOnSuccess() {
return this.persistOnSuccess;
}
/**
* Set the persistOnSuccess property: Gets or sets if the scripts needs to be persisted.
*
* @param persistOnSuccess the persistOnSuccess value to set.
* @return the ExecuteScriptActionParameters object itself.
*/
public ExecuteScriptActionParameters withPersistOnSuccess(boolean persistOnSuccess) {
this.persistOnSuccess = persistOnSuccess;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (scriptActions() != null) {
scriptActions().forEach(e -> e.validate());
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeBooleanField("persistOnSuccess", this.persistOnSuccess);
jsonWriter.writeArrayField("scriptActions", this.scriptActions, (writer, element) -> writer.writeJson(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of ExecuteScriptActionParameters from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of ExecuteScriptActionParameters 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 ExecuteScriptActionParameters.
*/
public static ExecuteScriptActionParameters fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
ExecuteScriptActionParameters deserializedExecuteScriptActionParameters
= new ExecuteScriptActionParameters();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("persistOnSuccess".equals(fieldName)) {
deserializedExecuteScriptActionParameters.persistOnSuccess = reader.getBoolean();
} else if ("scriptActions".equals(fieldName)) {
List scriptActions
= reader.readArray(reader1 -> RuntimeScriptAction.fromJson(reader1));
deserializedExecuteScriptActionParameters.scriptActions = scriptActions;
} else {
reader.skipChildren();
}
}
return deserializedExecuteScriptActionParameters;
});
}
}