com.azure.resourcemanager.automation.fluent.models.RunbookCreateOrUpdatePropertiesInner 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.fluent.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.models.ContentLink;
import com.azure.resourcemanager.automation.models.RunbookTypeEnum;
import java.io.IOException;
/**
* The parameters supplied to the create or update runbook properties.
*/
@Fluent
public final class RunbookCreateOrUpdatePropertiesInner
implements JsonSerializable {
/*
* Gets or sets verbose log option.
*/
private Boolean logVerbose;
/*
* Gets or sets progress log option.
*/
private Boolean logProgress;
/*
* Gets or sets the type of the runbook.
*/
private RunbookTypeEnum runbookType;
/*
* Gets or sets the draft runbook properties.
*/
private RunbookDraftInner draft;
/*
* Gets or sets the published runbook content link.
*/
private ContentLink publishContentLink;
/*
* Gets or sets the description of the runbook.
*/
private String description;
/*
* Gets or sets the activity-level tracing options of the runbook.
*/
private Integer logActivityTrace;
/**
* Creates an instance of RunbookCreateOrUpdatePropertiesInner class.
*/
public RunbookCreateOrUpdatePropertiesInner() {
}
/**
* Get the logVerbose property: Gets or sets verbose log option.
*
* @return the logVerbose value.
*/
public Boolean logVerbose() {
return this.logVerbose;
}
/**
* Set the logVerbose property: Gets or sets verbose log option.
*
* @param logVerbose the logVerbose value to set.
* @return the RunbookCreateOrUpdatePropertiesInner object itself.
*/
public RunbookCreateOrUpdatePropertiesInner withLogVerbose(Boolean logVerbose) {
this.logVerbose = logVerbose;
return this;
}
/**
* Get the logProgress property: Gets or sets progress log option.
*
* @return the logProgress value.
*/
public Boolean logProgress() {
return this.logProgress;
}
/**
* Set the logProgress property: Gets or sets progress log option.
*
* @param logProgress the logProgress value to set.
* @return the RunbookCreateOrUpdatePropertiesInner object itself.
*/
public RunbookCreateOrUpdatePropertiesInner withLogProgress(Boolean logProgress) {
this.logProgress = logProgress;
return this;
}
/**
* Get the runbookType property: Gets or sets the type of the runbook.
*
* @return the runbookType value.
*/
public RunbookTypeEnum runbookType() {
return this.runbookType;
}
/**
* Set the runbookType property: Gets or sets the type of the runbook.
*
* @param runbookType the runbookType value to set.
* @return the RunbookCreateOrUpdatePropertiesInner object itself.
*/
public RunbookCreateOrUpdatePropertiesInner withRunbookType(RunbookTypeEnum runbookType) {
this.runbookType = runbookType;
return this;
}
/**
* Get the draft property: Gets or sets the draft runbook properties.
*
* @return the draft value.
*/
public RunbookDraftInner draft() {
return this.draft;
}
/**
* Set the draft property: Gets or sets the draft runbook properties.
*
* @param draft the draft value to set.
* @return the RunbookCreateOrUpdatePropertiesInner object itself.
*/
public RunbookCreateOrUpdatePropertiesInner withDraft(RunbookDraftInner draft) {
this.draft = draft;
return this;
}
/**
* Get the publishContentLink property: Gets or sets the published runbook content link.
*
* @return the publishContentLink value.
*/
public ContentLink publishContentLink() {
return this.publishContentLink;
}
/**
* Set the publishContentLink property: Gets or sets the published runbook content link.
*
* @param publishContentLink the publishContentLink value to set.
* @return the RunbookCreateOrUpdatePropertiesInner object itself.
*/
public RunbookCreateOrUpdatePropertiesInner withPublishContentLink(ContentLink publishContentLink) {
this.publishContentLink = publishContentLink;
return this;
}
/**
* Get the description property: Gets or sets the description of the runbook.
*
* @return the description value.
*/
public String description() {
return this.description;
}
/**
* Set the description property: Gets or sets the description of the runbook.
*
* @param description the description value to set.
* @return the RunbookCreateOrUpdatePropertiesInner object itself.
*/
public RunbookCreateOrUpdatePropertiesInner withDescription(String description) {
this.description = description;
return this;
}
/**
* Get the logActivityTrace property: Gets or sets the activity-level tracing options of the runbook.
*
* @return the logActivityTrace value.
*/
public Integer logActivityTrace() {
return this.logActivityTrace;
}
/**
* Set the logActivityTrace property: Gets or sets the activity-level tracing options of the runbook.
*
* @param logActivityTrace the logActivityTrace value to set.
* @return the RunbookCreateOrUpdatePropertiesInner object itself.
*/
public RunbookCreateOrUpdatePropertiesInner withLogActivityTrace(Integer logActivityTrace) {
this.logActivityTrace = logActivityTrace;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (runbookType() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property runbookType in model RunbookCreateOrUpdatePropertiesInner"));
}
if (draft() != null) {
draft().validate();
}
if (publishContentLink() != null) {
publishContentLink().validate();
}
}
private static final ClientLogger LOGGER = new ClientLogger(RunbookCreateOrUpdatePropertiesInner.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("runbookType", this.runbookType == null ? null : this.runbookType.toString());
jsonWriter.writeBooleanField("logVerbose", this.logVerbose);
jsonWriter.writeBooleanField("logProgress", this.logProgress);
jsonWriter.writeJsonField("draft", this.draft);
jsonWriter.writeJsonField("publishContentLink", this.publishContentLink);
jsonWriter.writeStringField("description", this.description);
jsonWriter.writeNumberField("logActivityTrace", this.logActivityTrace);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of RunbookCreateOrUpdatePropertiesInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of RunbookCreateOrUpdatePropertiesInner 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 RunbookCreateOrUpdatePropertiesInner.
*/
public static RunbookCreateOrUpdatePropertiesInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
RunbookCreateOrUpdatePropertiesInner deserializedRunbookCreateOrUpdatePropertiesInner
= new RunbookCreateOrUpdatePropertiesInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("runbookType".equals(fieldName)) {
deserializedRunbookCreateOrUpdatePropertiesInner.runbookType
= RunbookTypeEnum.fromString(reader.getString());
} else if ("logVerbose".equals(fieldName)) {
deserializedRunbookCreateOrUpdatePropertiesInner.logVerbose
= reader.getNullable(JsonReader::getBoolean);
} else if ("logProgress".equals(fieldName)) {
deserializedRunbookCreateOrUpdatePropertiesInner.logProgress
= reader.getNullable(JsonReader::getBoolean);
} else if ("draft".equals(fieldName)) {
deserializedRunbookCreateOrUpdatePropertiesInner.draft = RunbookDraftInner.fromJson(reader);
} else if ("publishContentLink".equals(fieldName)) {
deserializedRunbookCreateOrUpdatePropertiesInner.publishContentLink = ContentLink.fromJson(reader);
} else if ("description".equals(fieldName)) {
deserializedRunbookCreateOrUpdatePropertiesInner.description = reader.getString();
} else if ("logActivityTrace".equals(fieldName)) {
deserializedRunbookCreateOrUpdatePropertiesInner.logActivityTrace
= reader.getNullable(JsonReader::getInt);
} else {
reader.skipChildren();
}
}
return deserializedRunbookCreateOrUpdatePropertiesInner;
});
}
}