com.azure.resourcemanager.automation.models.RunbookParameter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-automation Show documentation
Show all versions of azure-resourcemanager-automation Show documentation
This package contains Microsoft Azure SDK for Automation Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Automation Client. Package tag package-2022-02-22.
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.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 java.io.IOException;
/**
* Definition of the runbook parameter type.
*/
@Fluent
public final class RunbookParameter implements JsonSerializable {
/*
* Gets or sets the type of the parameter.
*/
private String type;
/*
* Gets or sets a Boolean value to indicate whether the parameter is mandatory or not.
*/
private Boolean isMandatory;
/*
* Get or sets the position of the parameter.
*/
private Integer position;
/*
* Gets or sets the default value of parameter.
*/
private String defaultValue;
/**
* Creates an instance of RunbookParameter class.
*/
public RunbookParameter() {
}
/**
* Get the type property: Gets or sets the type of the parameter.
*
* @return the type value.
*/
public String type() {
return this.type;
}
/**
* Set the type property: Gets or sets the type of the parameter.
*
* @param type the type value to set.
* @return the RunbookParameter object itself.
*/
public RunbookParameter withType(String type) {
this.type = type;
return this;
}
/**
* Get the isMandatory property: Gets or sets a Boolean value to indicate whether the parameter is mandatory or not.
*
* @return the isMandatory value.
*/
public Boolean isMandatory() {
return this.isMandatory;
}
/**
* Set the isMandatory property: Gets or sets a Boolean value to indicate whether the parameter is mandatory or not.
*
* @param isMandatory the isMandatory value to set.
* @return the RunbookParameter object itself.
*/
public RunbookParameter withIsMandatory(Boolean isMandatory) {
this.isMandatory = isMandatory;
return this;
}
/**
* Get the position property: Get or sets the position of the parameter.
*
* @return the position value.
*/
public Integer position() {
return this.position;
}
/**
* Set the position property: Get or sets the position of the parameter.
*
* @param position the position value to set.
* @return the RunbookParameter object itself.
*/
public RunbookParameter withPosition(Integer position) {
this.position = position;
return this;
}
/**
* Get the defaultValue property: Gets or sets the default value of parameter.
*
* @return the defaultValue value.
*/
public String defaultValue() {
return this.defaultValue;
}
/**
* Set the defaultValue property: Gets or sets the default value of parameter.
*
* @param defaultValue the defaultValue value to set.
* @return the RunbookParameter object itself.
*/
public RunbookParameter withDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
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("type", this.type);
jsonWriter.writeBooleanField("isMandatory", this.isMandatory);
jsonWriter.writeNumberField("position", this.position);
jsonWriter.writeStringField("defaultValue", this.defaultValue);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of RunbookParameter from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of RunbookParameter 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 RunbookParameter.
*/
public static RunbookParameter fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
RunbookParameter deserializedRunbookParameter = new RunbookParameter();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("type".equals(fieldName)) {
deserializedRunbookParameter.type = reader.getString();
} else if ("isMandatory".equals(fieldName)) {
deserializedRunbookParameter.isMandatory = reader.getNullable(JsonReader::getBoolean);
} else if ("position".equals(fieldName)) {
deserializedRunbookParameter.position = reader.getNullable(JsonReader::getInt);
} else if ("defaultValue".equals(fieldName)) {
deserializedRunbookParameter.defaultValue = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedRunbookParameter;
});
}
}