com.solidfire.element.apiactual.ApiCreateScheduleRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of solidfire-sdk-java Show documentation
Show all versions of solidfire-sdk-java Show documentation
Library for interfacing with the Public and Incubating SolidFire Element API.
The newest version!
/*
* Copyright © 2014-2016 NetApp, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* DO NOT EDIT THIS CODE BY HAND! It has been generated with jsvcgen.
*/
package com.solidfire.element.apiactual;
import com.solidfire.gson.annotations.SerializedName;
import com.solidfire.core.annotation.Since;
import com.solidfire.core.javautil.Optional;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Objects;
/**
* The Request object for the "CreateSchedule" API Service call.
**/
public class ApiCreateScheduleRequest implements Serializable {
private static final long serialVersionUID = 1829846833L;
@SerializedName("attributes")
private final java.util.Map attributes;
@SerializedName("hours")
private final Optional hours;
@SerializedName("minutes")
private final Optional minutes;
@SerializedName("paused")
private final Optional paused;
@SerializedName("recurring")
private final Optional recurring;
@SerializedName("scheduleName")
private final String scheduleName;
@SerializedName("scheduleType")
private final String scheduleType;
@SerializedName("scheduleInfo")
private final ApiScheduleInfo scheduleInfo;
@SerializedName("startingDate")
private final Optional startingDate;
@SerializedName("monthdays")
private final Optional monthdays;
@SerializedName("weekdays")
private final Optional weekdays;
/**
* The Request object for the "CreateSchedule" API Service call.
*
* @param attributes [required] The "frequency" object is returned in "attributes" to indicate the frequency at which the snapshot will be made.
* @param hours (optional) Number of hours between snapshots or hour at which the snapshot will occur in "Days of Week", or "Days of Month" mode.
* @param minutes (optional) Number of minutes between snapshots or minute at which the snapshot will occur in "Days of Week", or "Days of Month" mode.
* @param paused (optional) Indicates if the schedule should be paused or not.
* @param recurring (optional) Indicates if the schedule will be recurring or not.
* @param scheduleName [required] Unique name for the schedule.
* @param scheduleType [required] Indicates the type of schedule to create.
* @param scheduleInfo [required] An object of schedule information about how the snapshot should be created at each scheduled interval.
* @param startingDate (optional) Time after which the schedule will be run. If not set the schedule starts immediately. Formatted in UTC time.
* @param monthdays (optional) The days of the month that a snapshot will be made.
* @param weekdays (optional) Day of the week the snapshot is to be created.
* @since 8.0
**/
@Since("8.0")
public ApiCreateScheduleRequest(java.util.Map attributes, Optional hours, Optional minutes, Optional paused, Optional recurring, String scheduleName, String scheduleType, ApiScheduleInfo scheduleInfo, Optional startingDate, Optional monthdays, Optional weekdays) {
this.weekdays = (weekdays == null) ? Optional.empty() : weekdays;
this.monthdays = (monthdays == null) ? Optional.empty() : monthdays;
this.scheduleInfo = scheduleInfo;
this.attributes = attributes;
this.recurring = (recurring == null) ? Optional.empty() : recurring;
this.minutes = (minutes == null) ? Optional.empty() : minutes;
this.hours = (hours == null) ? Optional.empty() : hours;
this.paused = (paused == null) ? Optional.empty() : paused;
this.scheduleType = scheduleType;
this.startingDate = (startingDate == null) ? Optional.empty() : startingDate;
this.scheduleName = scheduleName;
}
/**
* The "frequency" object is returned in "attributes" to indicate the frequency at which the snapshot will be made.
* Valid values for "frequency" are:
* Days of Week
* Days of Month
* Time Interval
**/
public java.util.Map getAttributes() {
return this.attributes;
}
/**
* Number of hours between snapshots or hour at which the snapshot will occur in "Days of Week", or "Days of Month" mode.
* Valid values: 0 - 24
**/
public Optional getHours() {
return this.hours;
}
/**
* Number of minutes between snapshots or minute at which the snapshot will occur in "Days of Week", or "Days of Month" mode.
* Valid values: 0 - 59
**/
public Optional getMinutes() {
return this.minutes;
}
/**
* Indicates if the schedule should be paused or not.
**/
public Optional getPaused() {
return this.paused;
}
/**
* Indicates if the schedule will be recurring or not.
**/
public Optional getRecurring() {
return this.recurring;
}
/**
* Unique name for the schedule.
**/
public String getScheduleName() {
return this.scheduleName;
}
/**
* Indicates the type of schedule to create.
* Valid value is:
* snapshot
**/
public String getScheduleType() {
return this.scheduleType;
}
/**
* An object of schedule information about how the snapshot should be created at each scheduled interval.
* volumeID - The ID of the volume to be included in the snapshot. (Integer)
* volumes - A list of volume IDs to be included in the group snapshot. (Array of Integers)
* name - The snapshot name to be used. (String)
* enableRemoteReplication - Indicates if the snapshot should be included in remote replication. (Boolean)
* retention - The amount of time the snapshot will be retained in HH:mm:ss. (String)
**/
public ApiScheduleInfo getScheduleInfo() {
return this.scheduleInfo;
}
/**
* Time after which the schedule will be run. If not set the schedule starts immediately. Formatted in UTC time.
**/
public Optional getStartingDate() {
return this.startingDate;
}
/**
* The days of the month that a snapshot will be made.
* Valid values: 1 - 31
**/
public Optional getMonthdays() {
return this.monthdays;
}
/**
* Day of the week the snapshot is to be created.
* Required values:
* day: 0 - 6 (Sunday - Saturday)
* offset: 1
**/
public Optional getWeekdays() {
return this.weekdays;
}
/** {@inheritDoc} */
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ApiCreateScheduleRequest that = (ApiCreateScheduleRequest) o;
return Objects.equals(attributes, that.attributes)
&& Objects.equals(hours, that.hours)
&& Objects.equals(minutes, that.minutes)
&& Objects.equals(paused, that.paused)
&& Objects.equals(recurring, that.recurring)
&& Objects.equals(scheduleName, that.scheduleName)
&& Objects.equals(scheduleType, that.scheduleType)
&& Objects.equals(scheduleInfo, that.scheduleInfo)
&& Objects.equals(startingDate, that.startingDate)
&& Objects.deepEquals(monthdays, that.monthdays)
&& Objects.deepEquals(weekdays, that.weekdays);
}
/** {@inheritDoc} */
@Override
public int hashCode() {
return Objects.hash(attributes, hours, minutes, paused, recurring, scheduleName, scheduleType, scheduleInfo, startingDate, monthdays, weekdays);
}
/** {@inheritDoc} */
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("{ ");
sb.append(" attributes : ").append(attributes).append(",");
if (null != hours && hours.isPresent())
sb.append(" hours : ").append(hours.get()).append(",");
if (null != minutes && minutes.isPresent())
sb.append(" minutes : ").append(minutes.get()).append(",");
if (null != paused && paused.isPresent())
sb.append(" paused : ").append(paused.get()).append(",");
if (null != recurring && recurring.isPresent())
sb.append(" recurring : ").append(recurring.get()).append(",");
sb.append(" scheduleName : ").append(scheduleName).append(",");
sb.append(" scheduleType : ").append(scheduleType).append(",");
sb.append(" scheduleInfo : ").append(scheduleInfo).append(",");
if (null != startingDate && startingDate.isPresent())
sb.append(" startingDate : ").append(startingDate.get()).append(",");
if (null != monthdays && monthdays.isPresent())
sb.append(" monthdays : ").append(Arrays.toString(monthdays.get())).append(",");
if (null != weekdays && weekdays.isPresent())
sb.append(" weekdays : ").append(Arrays.toString(weekdays.get()));
sb.append(" }");
if (sb.lastIndexOf(", }") != -1)
sb.deleteCharAt(sb.lastIndexOf(", }"));
return sb.toString();
}
public static Builder builder() {
return new Builder();
}
public final Builder asBuilder() {
return new Builder().buildFrom(this);
}
public static class Builder {
private java.util.Map attributes;
private Optional hours;
private Optional minutes;
private Optional paused;
private Optional recurring;
private String scheduleName;
private String scheduleType;
private ApiScheduleInfo scheduleInfo;
private Optional startingDate;
private Optional monthdays;
private Optional weekdays;
/** Do not instantiate Builder. */
private Builder() {
}
public ApiCreateScheduleRequest build() {
return new ApiCreateScheduleRequest(
this.attributes,
this.hours,
this.minutes,
this.paused,
this.recurring,
this.scheduleName,
this.scheduleType,
this.scheduleInfo,
this.startingDate,
this.monthdays,
this.weekdays);
}
private ApiCreateScheduleRequest.Builder buildFrom(final ApiCreateScheduleRequest req) {
this.attributes = req.attributes;
this.hours = req.hours;
this.minutes = req.minutes;
this.paused = req.paused;
this.recurring = req.recurring;
this.scheduleName = req.scheduleName;
this.scheduleType = req.scheduleType;
this.scheduleInfo = req.scheduleInfo;
this.startingDate = req.startingDate;
this.monthdays = req.monthdays;
this.weekdays = req.weekdays;
return this;
}
public ApiCreateScheduleRequest.Builder attributes(final java.util.Map attributes) {
this.attributes = attributes;
return this;
}
public ApiCreateScheduleRequest.Builder optionalHours(final Long hours) {
this.hours = (hours == null) ? Optional.empty() : Optional.of(hours);
return this;
}
public ApiCreateScheduleRequest.Builder optionalMinutes(final Long minutes) {
this.minutes = (minutes == null) ? Optional.empty() : Optional.of(minutes);
return this;
}
public ApiCreateScheduleRequest.Builder optionalPaused(final Boolean paused) {
this.paused = (paused == null) ? Optional.empty() : Optional.of(paused);
return this;
}
public ApiCreateScheduleRequest.Builder optionalRecurring(final Boolean recurring) {
this.recurring = (recurring == null) ? Optional.empty() : Optional.of(recurring);
return this;
}
public ApiCreateScheduleRequest.Builder scheduleName(final String scheduleName) {
this.scheduleName = scheduleName;
return this;
}
public ApiCreateScheduleRequest.Builder scheduleType(final String scheduleType) {
this.scheduleType = scheduleType;
return this;
}
public ApiCreateScheduleRequest.Builder scheduleInfo(final ApiScheduleInfo scheduleInfo) {
this.scheduleInfo = scheduleInfo;
return this;
}
public ApiCreateScheduleRequest.Builder optionalStartingDate(final String startingDate) {
this.startingDate = (startingDate == null) ? Optional.empty() : Optional.of(startingDate);
return this;
}
public ApiCreateScheduleRequest.Builder optionalMonthdays(final Long[] monthdays) {
this.monthdays = (monthdays == null) ? Optional.empty() : Optional.of(monthdays);
return this;
}
public ApiCreateScheduleRequest.Builder optionalWeekdays(final ApiWeekday[] weekdays) {
this.weekdays = (weekdays == null) ? Optional.empty() : Optional.of(weekdays);
return this;
}
}
}