com.azure.resourcemanager.automation.models.JobCreateParameters 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.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 com.azure.resourcemanager.automation.fluent.models.JobCreateProperties;
import java.io.IOException;
import java.util.Map;
/**
* The parameters supplied to the create job operation.
*/
@Fluent
public final class JobCreateParameters implements JsonSerializable {
/*
* Gets or sets the list of job properties.
*/
private JobCreateProperties innerProperties = new JobCreateProperties();
/**
* Creates an instance of JobCreateParameters class.
*/
public JobCreateParameters() {
}
/**
* Get the innerProperties property: Gets or sets the list of job properties.
*
* @return the innerProperties value.
*/
private JobCreateProperties innerProperties() {
return this.innerProperties;
}
/**
* Get the runbook property: Gets or sets the runbook.
*
* @return the runbook value.
*/
public RunbookAssociationProperty runbook() {
return this.innerProperties() == null ? null : this.innerProperties().runbook();
}
/**
* Set the runbook property: Gets or sets the runbook.
*
* @param runbook the runbook value to set.
* @return the JobCreateParameters object itself.
*/
public JobCreateParameters withRunbook(RunbookAssociationProperty runbook) {
if (this.innerProperties() == null) {
this.innerProperties = new JobCreateProperties();
}
this.innerProperties().withRunbook(runbook);
return this;
}
/**
* Get the parameters property: Gets or sets the parameters of the job.
*
* @return the parameters value.
*/
public Map parameters() {
return this.innerProperties() == null ? null : this.innerProperties().parameters();
}
/**
* Set the parameters property: Gets or sets the parameters of the job.
*
* @param parameters the parameters value to set.
* @return the JobCreateParameters object itself.
*/
public JobCreateParameters withParameters(Map parameters) {
if (this.innerProperties() == null) {
this.innerProperties = new JobCreateProperties();
}
this.innerProperties().withParameters(parameters);
return this;
}
/**
* Get the runOn property: Gets or sets the runOn which specifies the group name where the job is to be executed.
*
* @return the runOn value.
*/
public String runOn() {
return this.innerProperties() == null ? null : this.innerProperties().runOn();
}
/**
* Set the runOn property: Gets or sets the runOn which specifies the group name where the job is to be executed.
*
* @param runOn the runOn value to set.
* @return the JobCreateParameters object itself.
*/
public JobCreateParameters withRunOn(String runOn) {
if (this.innerProperties() == null) {
this.innerProperties = new JobCreateProperties();
}
this.innerProperties().withRunOn(runOn);
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (innerProperties() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property innerProperties in model JobCreateParameters"));
} else {
innerProperties().validate();
}
}
private static final ClientLogger LOGGER = new ClientLogger(JobCreateParameters.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("properties", this.innerProperties);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of JobCreateParameters from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of JobCreateParameters 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 JobCreateParameters.
*/
public static JobCreateParameters fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
JobCreateParameters deserializedJobCreateParameters = new JobCreateParameters();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("properties".equals(fieldName)) {
deserializedJobCreateParameters.innerProperties = JobCreateProperties.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedJobCreateParameters;
});
}
}