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

com.azure.resourcemanager.automation.fluent.models.JobScheduleProperties 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.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.automation.models.RunbookAssociationProperty;
import com.azure.resourcemanager.automation.models.ScheduleAssociationProperty;
import java.io.IOException;
import java.util.Map;

/**
 * Definition of job schedule parameters.
 */
@Fluent
public final class JobScheduleProperties implements JsonSerializable {
    /*
     * Gets or sets the id of job schedule.
     */
    private String jobScheduleId;

    /*
     * Gets or sets the schedule.
     */
    private ScheduleAssociationProperty schedule;

    /*
     * Gets or sets the runbook.
     */
    private RunbookAssociationProperty runbook;

    /*
     * Gets or sets the hybrid worker group that the scheduled job should run on.
     */
    private String runOn;

    /*
     * Gets or sets the parameters of the job schedule.
     */
    private Map parameters;

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

    /**
     * Get the jobScheduleId property: Gets or sets the id of job schedule.
     * 
     * @return the jobScheduleId value.
     */
    public String jobScheduleId() {
        return this.jobScheduleId;
    }

    /**
     * Set the jobScheduleId property: Gets or sets the id of job schedule.
     * 
     * @param jobScheduleId the jobScheduleId value to set.
     * @return the JobScheduleProperties object itself.
     */
    public JobScheduleProperties withJobScheduleId(String jobScheduleId) {
        this.jobScheduleId = jobScheduleId;
        return this;
    }

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

    /**
     * Set the schedule property: Gets or sets the schedule.
     * 
     * @param schedule the schedule value to set.
     * @return the JobScheduleProperties object itself.
     */
    public JobScheduleProperties withSchedule(ScheduleAssociationProperty schedule) {
        this.schedule = schedule;
        return this;
    }

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

    /**
     * Set the runbook property: Gets or sets the runbook.
     * 
     * @param runbook the runbook value to set.
     * @return the JobScheduleProperties object itself.
     */
    public JobScheduleProperties withRunbook(RunbookAssociationProperty runbook) {
        this.runbook = runbook;
        return this;
    }

    /**
     * Get the runOn property: Gets or sets the hybrid worker group that the scheduled job should run on.
     * 
     * @return the runOn value.
     */
    public String runOn() {
        return this.runOn;
    }

    /**
     * Set the runOn property: Gets or sets the hybrid worker group that the scheduled job should run on.
     * 
     * @param runOn the runOn value to set.
     * @return the JobScheduleProperties object itself.
     */
    public JobScheduleProperties withRunOn(String runOn) {
        this.runOn = runOn;
        return this;
    }

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

    /**
     * Set the parameters property: Gets or sets the parameters of the job schedule.
     * 
     * @param parameters the parameters value to set.
     * @return the JobScheduleProperties object itself.
     */
    public JobScheduleProperties withParameters(Map parameters) {
        this.parameters = parameters;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (schedule() != null) {
            schedule().validate();
        }
        if (runbook() != null) {
            runbook().validate();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("jobScheduleId", this.jobScheduleId);
        jsonWriter.writeJsonField("schedule", this.schedule);
        jsonWriter.writeJsonField("runbook", this.runbook);
        jsonWriter.writeStringField("runOn", this.runOn);
        jsonWriter.writeMapField("parameters", this.parameters, (writer, element) -> writer.writeString(element));
        return jsonWriter.writeEndObject();
    }

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

                if ("jobScheduleId".equals(fieldName)) {
                    deserializedJobScheduleProperties.jobScheduleId = reader.getString();
                } else if ("schedule".equals(fieldName)) {
                    deserializedJobScheduleProperties.schedule = ScheduleAssociationProperty.fromJson(reader);
                } else if ("runbook".equals(fieldName)) {
                    deserializedJobScheduleProperties.runbook = RunbookAssociationProperty.fromJson(reader);
                } else if ("runOn".equals(fieldName)) {
                    deserializedJobScheduleProperties.runOn = reader.getString();
                } else if ("parameters".equals(fieldName)) {
                    Map parameters = reader.readMap(reader1 -> reader1.getString());
                    deserializedJobScheduleProperties.parameters = parameters;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedJobScheduleProperties;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy