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

com.azure.resourcemanager.automation.fluent.models.JobScheduleInner 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.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 the job schedule.
 */
@Fluent
public final class JobScheduleInner implements JsonSerializable {
    /*
     * Gets the id of the resource.
     */
    private String id;

    /*
     * Gets the name of the variable.
     */
    private String name;

    /*
     * Resource type
     */
    private String type;

    /*
     * Gets or sets the properties of the job schedule.
     */
    private JobScheduleProperties innerProperties;

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

    /**
     * Get the id property: Gets the id of the resource.
     * 
     * @return the id value.
     */
    public String id() {
        return this.id;
    }

    /**
     * Get the name property: Gets the name of the variable.
     * 
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Get the type property: Resource type.
     * 
     * @return the type value.
     */
    public String type() {
        return this.type;
    }

    /**
     * Get the innerProperties property: Gets or sets the properties of the job schedule.
     * 
     * @return the innerProperties value.
     */
    private JobScheduleProperties innerProperties() {
        return this.innerProperties;
    }

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

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

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

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

    /**
     * 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 JobScheduleInner object itself.
     */
    public JobScheduleInner withRunbook(RunbookAssociationProperty runbook) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobScheduleProperties();
        }
        this.innerProperties().withRunbook(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.innerProperties() == null ? null : this.innerProperties().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 JobScheduleInner object itself.
     */
    public JobScheduleInner withRunOn(String runOn) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobScheduleProperties();
        }
        this.innerProperties().withRunOn(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.innerProperties() == null ? null : this.innerProperties().parameters();
    }

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

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeJsonField("properties", this.innerProperties);
        return jsonWriter.writeEndObject();
    }

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

                if ("id".equals(fieldName)) {
                    deserializedJobScheduleInner.id = reader.getString();
                } else if ("name".equals(fieldName)) {
                    deserializedJobScheduleInner.name = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedJobScheduleInner.type = reader.getString();
                } else if ("properties".equals(fieldName)) {
                    deserializedJobScheduleInner.innerProperties = JobScheduleProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedJobScheduleInner;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy