![JAR search and dependency download from the Maven repository](/logo.png)
com.azure.resourcemanager.automation.fluent.models.RunbookDraftInner Maven / Gradle / Ivy
// 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.CoreUtils;
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.RunbookParameter;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
/**
* The RunbookDraft model.
*/
@Fluent
public final class RunbookDraftInner implements JsonSerializable {
/*
* Gets or sets whether runbook is in edit mode.
*/
private Boolean inEdit;
/*
* Gets or sets the draft runbook content link.
*/
private ContentLink draftContentLink;
/*
* Gets or sets the creation time of the runbook draft.
*/
private OffsetDateTime creationTime;
/*
* Gets or sets the last modified time of the runbook draft.
*/
private OffsetDateTime lastModifiedTime;
/*
* Gets or sets the runbook draft parameters.
*/
private Map parameters;
/*
* Gets or sets the runbook output types.
*/
private List outputTypes;
/**
* Creates an instance of RunbookDraftInner class.
*/
public RunbookDraftInner() {
}
/**
* Get the inEdit property: Gets or sets whether runbook is in edit mode.
*
* @return the inEdit value.
*/
public Boolean inEdit() {
return this.inEdit;
}
/**
* Set the inEdit property: Gets or sets whether runbook is in edit mode.
*
* @param inEdit the inEdit value to set.
* @return the RunbookDraftInner object itself.
*/
public RunbookDraftInner withInEdit(Boolean inEdit) {
this.inEdit = inEdit;
return this;
}
/**
* Get the draftContentLink property: Gets or sets the draft runbook content link.
*
* @return the draftContentLink value.
*/
public ContentLink draftContentLink() {
return this.draftContentLink;
}
/**
* Set the draftContentLink property: Gets or sets the draft runbook content link.
*
* @param draftContentLink the draftContentLink value to set.
* @return the RunbookDraftInner object itself.
*/
public RunbookDraftInner withDraftContentLink(ContentLink draftContentLink) {
this.draftContentLink = draftContentLink;
return this;
}
/**
* Get the creationTime property: Gets or sets the creation time of the runbook draft.
*
* @return the creationTime value.
*/
public OffsetDateTime creationTime() {
return this.creationTime;
}
/**
* Set the creationTime property: Gets or sets the creation time of the runbook draft.
*
* @param creationTime the creationTime value to set.
* @return the RunbookDraftInner object itself.
*/
public RunbookDraftInner withCreationTime(OffsetDateTime creationTime) {
this.creationTime = creationTime;
return this;
}
/**
* Get the lastModifiedTime property: Gets or sets the last modified time of the runbook draft.
*
* @return the lastModifiedTime value.
*/
public OffsetDateTime lastModifiedTime() {
return this.lastModifiedTime;
}
/**
* Set the lastModifiedTime property: Gets or sets the last modified time of the runbook draft.
*
* @param lastModifiedTime the lastModifiedTime value to set.
* @return the RunbookDraftInner object itself.
*/
public RunbookDraftInner withLastModifiedTime(OffsetDateTime lastModifiedTime) {
this.lastModifiedTime = lastModifiedTime;
return this;
}
/**
* Get the parameters property: Gets or sets the runbook draft parameters.
*
* @return the parameters value.
*/
public Map parameters() {
return this.parameters;
}
/**
* Set the parameters property: Gets or sets the runbook draft parameters.
*
* @param parameters the parameters value to set.
* @return the RunbookDraftInner object itself.
*/
public RunbookDraftInner withParameters(Map parameters) {
this.parameters = parameters;
return this;
}
/**
* Get the outputTypes property: Gets or sets the runbook output types.
*
* @return the outputTypes value.
*/
public List outputTypes() {
return this.outputTypes;
}
/**
* Set the outputTypes property: Gets or sets the runbook output types.
*
* @param outputTypes the outputTypes value to set.
* @return the RunbookDraftInner object itself.
*/
public RunbookDraftInner withOutputTypes(List outputTypes) {
this.outputTypes = outputTypes;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (draftContentLink() != null) {
draftContentLink().validate();
}
if (parameters() != null) {
parameters().values().forEach(e -> {
if (e != null) {
e.validate();
}
});
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeBooleanField("inEdit", this.inEdit);
jsonWriter.writeJsonField("draftContentLink", this.draftContentLink);
jsonWriter.writeStringField("creationTime",
this.creationTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.creationTime));
jsonWriter.writeStringField("lastModifiedTime",
this.lastModifiedTime == null
? null
: DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastModifiedTime));
jsonWriter.writeMapField("parameters", this.parameters, (writer, element) -> writer.writeJson(element));
jsonWriter.writeArrayField("outputTypes", this.outputTypes, (writer, element) -> writer.writeString(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of RunbookDraftInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of RunbookDraftInner 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 RunbookDraftInner.
*/
public static RunbookDraftInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
RunbookDraftInner deserializedRunbookDraftInner = new RunbookDraftInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("inEdit".equals(fieldName)) {
deserializedRunbookDraftInner.inEdit = reader.getNullable(JsonReader::getBoolean);
} else if ("draftContentLink".equals(fieldName)) {
deserializedRunbookDraftInner.draftContentLink = ContentLink.fromJson(reader);
} else if ("creationTime".equals(fieldName)) {
deserializedRunbookDraftInner.creationTime = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("lastModifiedTime".equals(fieldName)) {
deserializedRunbookDraftInner.lastModifiedTime = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("parameters".equals(fieldName)) {
Map parameters
= reader.readMap(reader1 -> RunbookParameter.fromJson(reader1));
deserializedRunbookDraftInner.parameters = parameters;
} else if ("outputTypes".equals(fieldName)) {
List outputTypes = reader.readArray(reader1 -> reader1.getString());
deserializedRunbookDraftInner.outputTypes = outputTypes;
} else {
reader.skipChildren();
}
}
return deserializedRunbookDraftInner;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy