All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.automation.fluent.models.RunbookPropertiesInner Maven / Gradle / Ivy

Go to download

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.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 com.azure.resourcemanager.automation.models.RunbookProvisioningState;
import com.azure.resourcemanager.automation.models.RunbookState;
import com.azure.resourcemanager.automation.models.RunbookTypeEnum;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;

/**
 * Definition of the runbook property type.
 */
@Fluent
public final class RunbookPropertiesInner implements JsonSerializable {
    /*
     * Gets or sets the type of the runbook.
     */
    private RunbookTypeEnum runbookType;

    /*
     * Gets or sets the published runbook content link.
     */
    private ContentLink publishContentLink;

    /*
     * Gets or sets the state of the runbook.
     */
    private RunbookState state;

    /*
     * Gets or sets verbose log option.
     */
    private Boolean logVerbose;

    /*
     * Gets or sets progress log option.
     */
    private Boolean logProgress;

    /*
     * Gets or sets the option to log activity trace of the runbook.
     */
    private Integer logActivityTrace;

    /*
     * Gets or sets the job count of the runbook.
     */
    private Integer jobCount;

    /*
     * Gets or sets the runbook parameters.
     */
    private Map parameters;

    /*
     * Gets or sets the runbook output types.
     */
    private List outputTypes;

    /*
     * Gets or sets the draft runbook properties.
     */
    private RunbookDraftInner draft;

    /*
     * Gets or sets the provisioning state of the runbook.
     */
    private RunbookProvisioningState provisioningState;

    /*
     * Gets or sets the last modified by.
     */
    private String lastModifiedBy;

    /*
     * Gets or sets the creation time.
     */
    private OffsetDateTime creationTime;

    /*
     * Gets or sets the last modified time.
     */
    private OffsetDateTime lastModifiedTime;

    /*
     * Gets or sets the description.
     */
    private String description;

    /**
     * Creates an instance of RunbookPropertiesInner class.
     */
    public RunbookPropertiesInner() {
    }

    /**
     * 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 RunbookPropertiesInner object itself.
     */
    public RunbookPropertiesInner withRunbookType(RunbookTypeEnum runbookType) {
        this.runbookType = runbookType;
        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 RunbookPropertiesInner object itself.
     */
    public RunbookPropertiesInner withPublishContentLink(ContentLink publishContentLink) {
        this.publishContentLink = publishContentLink;
        return this;
    }

    /**
     * Get the state property: Gets or sets the state of the runbook.
     * 
     * @return the state value.
     */
    public RunbookState state() {
        return this.state;
    }

    /**
     * Set the state property: Gets or sets the state of the runbook.
     * 
     * @param state the state value to set.
     * @return the RunbookPropertiesInner object itself.
     */
    public RunbookPropertiesInner withState(RunbookState state) {
        this.state = state;
        return this;
    }

    /**
     * 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 RunbookPropertiesInner object itself.
     */
    public RunbookPropertiesInner 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 RunbookPropertiesInner object itself.
     */
    public RunbookPropertiesInner withLogProgress(Boolean logProgress) {
        this.logProgress = logProgress;
        return this;
    }

    /**
     * Get the logActivityTrace property: Gets or sets the option to log activity trace of the runbook.
     * 
     * @return the logActivityTrace value.
     */
    public Integer logActivityTrace() {
        return this.logActivityTrace;
    }

    /**
     * Set the logActivityTrace property: Gets or sets the option to log activity trace of the runbook.
     * 
     * @param logActivityTrace the logActivityTrace value to set.
     * @return the RunbookPropertiesInner object itself.
     */
    public RunbookPropertiesInner withLogActivityTrace(Integer logActivityTrace) {
        this.logActivityTrace = logActivityTrace;
        return this;
    }

    /**
     * Get the jobCount property: Gets or sets the job count of the runbook.
     * 
     * @return the jobCount value.
     */
    public Integer jobCount() {
        return this.jobCount;
    }

    /**
     * Set the jobCount property: Gets or sets the job count of the runbook.
     * 
     * @param jobCount the jobCount value to set.
     * @return the RunbookPropertiesInner object itself.
     */
    public RunbookPropertiesInner withJobCount(Integer jobCount) {
        this.jobCount = jobCount;
        return this;
    }

    /**
     * Get the parameters property: Gets or sets the runbook parameters.
     * 
     * @return the parameters value.
     */
    public Map parameters() {
        return this.parameters;
    }

    /**
     * Set the parameters property: Gets or sets the runbook parameters.
     * 
     * @param parameters the parameters value to set.
     * @return the RunbookPropertiesInner object itself.
     */
    public RunbookPropertiesInner 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 RunbookPropertiesInner object itself.
     */
    public RunbookPropertiesInner withOutputTypes(List outputTypes) {
        this.outputTypes = outputTypes;
        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 RunbookPropertiesInner object itself.
     */
    public RunbookPropertiesInner withDraft(RunbookDraftInner draft) {
        this.draft = draft;
        return this;
    }

    /**
     * Get the provisioningState property: Gets or sets the provisioning state of the runbook.
     * 
     * @return the provisioningState value.
     */
    public RunbookProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Set the provisioningState property: Gets or sets the provisioning state of the runbook.
     * 
     * @param provisioningState the provisioningState value to set.
     * @return the RunbookPropertiesInner object itself.
     */
    public RunbookPropertiesInner withProvisioningState(RunbookProvisioningState provisioningState) {
        this.provisioningState = provisioningState;
        return this;
    }

    /**
     * Get the lastModifiedBy property: Gets or sets the last modified by.
     * 
     * @return the lastModifiedBy value.
     */
    public String lastModifiedBy() {
        return this.lastModifiedBy;
    }

    /**
     * Set the lastModifiedBy property: Gets or sets the last modified by.
     * 
     * @param lastModifiedBy the lastModifiedBy value to set.
     * @return the RunbookPropertiesInner object itself.
     */
    public RunbookPropertiesInner withLastModifiedBy(String lastModifiedBy) {
        this.lastModifiedBy = lastModifiedBy;
        return this;
    }

    /**
     * Get the creationTime property: Gets or sets the creation time.
     * 
     * @return the creationTime value.
     */
    public OffsetDateTime creationTime() {
        return this.creationTime;
    }

    /**
     * Set the creationTime property: Gets or sets the creation time.
     * 
     * @param creationTime the creationTime value to set.
     * @return the RunbookPropertiesInner object itself.
     */
    public RunbookPropertiesInner withCreationTime(OffsetDateTime creationTime) {
        this.creationTime = creationTime;
        return this;
    }

    /**
     * Get the lastModifiedTime property: Gets or sets the last modified time.
     * 
     * @return the lastModifiedTime value.
     */
    public OffsetDateTime lastModifiedTime() {
        return this.lastModifiedTime;
    }

    /**
     * Set the lastModifiedTime property: Gets or sets the last modified time.
     * 
     * @param lastModifiedTime the lastModifiedTime value to set.
     * @return the RunbookPropertiesInner object itself.
     */
    public RunbookPropertiesInner withLastModifiedTime(OffsetDateTime lastModifiedTime) {
        this.lastModifiedTime = lastModifiedTime;
        return this;
    }

    /**
     * Get the description property: Gets or sets the description.
     * 
     * @return the description value.
     */
    public String description() {
        return this.description;
    }

    /**
     * Set the description property: Gets or sets the description.
     * 
     * @param description the description value to set.
     * @return the RunbookPropertiesInner object itself.
     */
    public RunbookPropertiesInner withDescription(String description) {
        this.description = description;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (publishContentLink() != null) {
            publishContentLink().validate();
        }
        if (parameters() != null) {
            parameters().values().forEach(e -> {
                if (e != null) {
                    e.validate();
                }
            });
        }
        if (draft() != null) {
            draft().validate();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("runbookType", this.runbookType == null ? null : this.runbookType.toString());
        jsonWriter.writeJsonField("publishContentLink", this.publishContentLink);
        jsonWriter.writeStringField("state", this.state == null ? null : this.state.toString());
        jsonWriter.writeBooleanField("logVerbose", this.logVerbose);
        jsonWriter.writeBooleanField("logProgress", this.logProgress);
        jsonWriter.writeNumberField("logActivityTrace", this.logActivityTrace);
        jsonWriter.writeNumberField("jobCount", this.jobCount);
        jsonWriter.writeMapField("parameters", this.parameters, (writer, element) -> writer.writeJson(element));
        jsonWriter.writeArrayField("outputTypes", this.outputTypes, (writer, element) -> writer.writeString(element));
        jsonWriter.writeJsonField("draft", this.draft);
        jsonWriter.writeStringField("provisioningState",
            this.provisioningState == null ? null : this.provisioningState.toString());
        jsonWriter.writeStringField("lastModifiedBy", this.lastModifiedBy);
        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.writeStringField("description", this.description);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of RunbookPropertiesInner from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of RunbookPropertiesInner 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 RunbookPropertiesInner.
     */
    public static RunbookPropertiesInner fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            RunbookPropertiesInner deserializedRunbookPropertiesInner = new RunbookPropertiesInner();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("runbookType".equals(fieldName)) {
                    deserializedRunbookPropertiesInner.runbookType = RunbookTypeEnum.fromString(reader.getString());
                } else if ("publishContentLink".equals(fieldName)) {
                    deserializedRunbookPropertiesInner.publishContentLink = ContentLink.fromJson(reader);
                } else if ("state".equals(fieldName)) {
                    deserializedRunbookPropertiesInner.state = RunbookState.fromString(reader.getString());
                } else if ("logVerbose".equals(fieldName)) {
                    deserializedRunbookPropertiesInner.logVerbose = reader.getNullable(JsonReader::getBoolean);
                } else if ("logProgress".equals(fieldName)) {
                    deserializedRunbookPropertiesInner.logProgress = reader.getNullable(JsonReader::getBoolean);
                } else if ("logActivityTrace".equals(fieldName)) {
                    deserializedRunbookPropertiesInner.logActivityTrace = reader.getNullable(JsonReader::getInt);
                } else if ("jobCount".equals(fieldName)) {
                    deserializedRunbookPropertiesInner.jobCount = reader.getNullable(JsonReader::getInt);
                } else if ("parameters".equals(fieldName)) {
                    Map parameters
                        = reader.readMap(reader1 -> RunbookParameter.fromJson(reader1));
                    deserializedRunbookPropertiesInner.parameters = parameters;
                } else if ("outputTypes".equals(fieldName)) {
                    List outputTypes = reader.readArray(reader1 -> reader1.getString());
                    deserializedRunbookPropertiesInner.outputTypes = outputTypes;
                } else if ("draft".equals(fieldName)) {
                    deserializedRunbookPropertiesInner.draft = RunbookDraftInner.fromJson(reader);
                } else if ("provisioningState".equals(fieldName)) {
                    deserializedRunbookPropertiesInner.provisioningState
                        = RunbookProvisioningState.fromString(reader.getString());
                } else if ("lastModifiedBy".equals(fieldName)) {
                    deserializedRunbookPropertiesInner.lastModifiedBy = reader.getString();
                } else if ("creationTime".equals(fieldName)) {
                    deserializedRunbookPropertiesInner.creationTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("lastModifiedTime".equals(fieldName)) {
                    deserializedRunbookPropertiesInner.lastModifiedTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("description".equals(fieldName)) {
                    deserializedRunbookPropertiesInner.description = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedRunbookPropertiesInner;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy