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

com.azure.resourcemanager.datafactory.models.ScheduleTriggerRecurrence 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.datafactory.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 java.io.IOException;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * The workflow trigger recurrence.
 */
@Fluent
public final class ScheduleTriggerRecurrence implements JsonSerializable {
    /*
     * The frequency.
     */
    private RecurrenceFrequency frequency;

    /*
     * The interval.
     */
    private Integer interval;

    /*
     * The start time.
     */
    private OffsetDateTime startTime;

    /*
     * The end time.
     */
    private OffsetDateTime endTime;

    /*
     * The time zone.
     */
    private String timeZone;

    /*
     * The recurrence schedule.
     */
    private RecurrenceSchedule schedule;

    /*
     * The workflow trigger recurrence.
     */
    private Map additionalProperties;

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

    /**
     * Get the frequency property: The frequency.
     * 
     * @return the frequency value.
     */
    public RecurrenceFrequency frequency() {
        return this.frequency;
    }

    /**
     * Set the frequency property: The frequency.
     * 
     * @param frequency the frequency value to set.
     * @return the ScheduleTriggerRecurrence object itself.
     */
    public ScheduleTriggerRecurrence withFrequency(RecurrenceFrequency frequency) {
        this.frequency = frequency;
        return this;
    }

    /**
     * Get the interval property: The interval.
     * 
     * @return the interval value.
     */
    public Integer interval() {
        return this.interval;
    }

    /**
     * Set the interval property: The interval.
     * 
     * @param interval the interval value to set.
     * @return the ScheduleTriggerRecurrence object itself.
     */
    public ScheduleTriggerRecurrence withInterval(Integer interval) {
        this.interval = interval;
        return this;
    }

    /**
     * Get the startTime property: The start time.
     * 
     * @return the startTime value.
     */
    public OffsetDateTime startTime() {
        return this.startTime;
    }

    /**
     * Set the startTime property: The start time.
     * 
     * @param startTime the startTime value to set.
     * @return the ScheduleTriggerRecurrence object itself.
     */
    public ScheduleTriggerRecurrence withStartTime(OffsetDateTime startTime) {
        this.startTime = startTime;
        return this;
    }

    /**
     * Get the endTime property: The end time.
     * 
     * @return the endTime value.
     */
    public OffsetDateTime endTime() {
        return this.endTime;
    }

    /**
     * Set the endTime property: The end time.
     * 
     * @param endTime the endTime value to set.
     * @return the ScheduleTriggerRecurrence object itself.
     */
    public ScheduleTriggerRecurrence withEndTime(OffsetDateTime endTime) {
        this.endTime = endTime;
        return this;
    }

    /**
     * Get the timeZone property: The time zone.
     * 
     * @return the timeZone value.
     */
    public String timeZone() {
        return this.timeZone;
    }

    /**
     * Set the timeZone property: The time zone.
     * 
     * @param timeZone the timeZone value to set.
     * @return the ScheduleTriggerRecurrence object itself.
     */
    public ScheduleTriggerRecurrence withTimeZone(String timeZone) {
        this.timeZone = timeZone;
        return this;
    }

    /**
     * Get the schedule property: The recurrence schedule.
     * 
     * @return the schedule value.
     */
    public RecurrenceSchedule schedule() {
        return this.schedule;
    }

    /**
     * Set the schedule property: The recurrence schedule.
     * 
     * @param schedule the schedule value to set.
     * @return the ScheduleTriggerRecurrence object itself.
     */
    public ScheduleTriggerRecurrence withSchedule(RecurrenceSchedule schedule) {
        this.schedule = schedule;
        return this;
    }

    /**
     * Get the additionalProperties property: The workflow trigger recurrence.
     * 
     * @return the additionalProperties value.
     */
    public Map additionalProperties() {
        return this.additionalProperties;
    }

    /**
     * Set the additionalProperties property: The workflow trigger recurrence.
     * 
     * @param additionalProperties the additionalProperties value to set.
     * @return the ScheduleTriggerRecurrence object itself.
     */
    public ScheduleTriggerRecurrence withAdditionalProperties(Map additionalProperties) {
        this.additionalProperties = additionalProperties;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("frequency", this.frequency == null ? null : this.frequency.toString());
        jsonWriter.writeNumberField("interval", this.interval);
        jsonWriter.writeStringField("startTime",
            this.startTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTime));
        jsonWriter.writeStringField("endTime",
            this.endTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endTime));
        jsonWriter.writeStringField("timeZone", this.timeZone);
        jsonWriter.writeJsonField("schedule", this.schedule);
        if (additionalProperties != null) {
            for (Map.Entry additionalProperty : additionalProperties.entrySet()) {
                jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue());
            }
        }
        return jsonWriter.writeEndObject();
    }

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

                if ("frequency".equals(fieldName)) {
                    deserializedScheduleTriggerRecurrence.frequency
                        = RecurrenceFrequency.fromString(reader.getString());
                } else if ("interval".equals(fieldName)) {
                    deserializedScheduleTriggerRecurrence.interval = reader.getNullable(JsonReader::getInt);
                } else if ("startTime".equals(fieldName)) {
                    deserializedScheduleTriggerRecurrence.startTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("endTime".equals(fieldName)) {
                    deserializedScheduleTriggerRecurrence.endTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("timeZone".equals(fieldName)) {
                    deserializedScheduleTriggerRecurrence.timeZone = reader.getString();
                } else if ("schedule".equals(fieldName)) {
                    deserializedScheduleTriggerRecurrence.schedule = RecurrenceSchedule.fromJson(reader);
                } else {
                    if (additionalProperties == null) {
                        additionalProperties = new LinkedHashMap<>();
                    }

                    additionalProperties.put(fieldName, reader.readUntyped());
                }
            }
            deserializedScheduleTriggerRecurrence.additionalProperties = additionalProperties;

            return deserializedScheduleTriggerRecurrence;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy