
software.amazon.awssdk.services.ssm.model.UpdateMaintenanceWindowRequest Maven / Gradle / Ivy
/*
* Copyright 2014-2019 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.
*/
package software.amazon.awssdk.services.ssm.model;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class UpdateMaintenanceWindowRequest extends SsmRequest implements
ToCopyableBuilder {
private static final SdkField WINDOW_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(UpdateMaintenanceWindowRequest::windowId)).setter(setter(Builder::windowId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("WindowId").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(UpdateMaintenanceWindowRequest::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(UpdateMaintenanceWindowRequest::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build();
private static final SdkField START_DATE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(UpdateMaintenanceWindowRequest::startDate)).setter(setter(Builder::startDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StartDate").build()).build();
private static final SdkField END_DATE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(UpdateMaintenanceWindowRequest::endDate)).setter(setter(Builder::endDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndDate").build()).build();
private static final SdkField SCHEDULE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(UpdateMaintenanceWindowRequest::schedule)).setter(setter(Builder::schedule))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Schedule").build()).build();
private static final SdkField SCHEDULE_TIMEZONE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(UpdateMaintenanceWindowRequest::scheduleTimezone)).setter(setter(Builder::scheduleTimezone))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ScheduleTimezone").build()).build();
private static final SdkField DURATION_FIELD = SdkField. builder(MarshallingType.INTEGER)
.getter(getter(UpdateMaintenanceWindowRequest::duration)).setter(setter(Builder::duration))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Duration").build()).build();
private static final SdkField CUTOFF_FIELD = SdkField. builder(MarshallingType.INTEGER)
.getter(getter(UpdateMaintenanceWindowRequest::cutoff)).setter(setter(Builder::cutoff))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Cutoff").build()).build();
private static final SdkField ALLOW_UNASSOCIATED_TARGETS_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.getter(getter(UpdateMaintenanceWindowRequest::allowUnassociatedTargets))
.setter(setter(Builder::allowUnassociatedTargets))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AllowUnassociatedTargets").build())
.build();
private static final SdkField ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.getter(getter(UpdateMaintenanceWindowRequest::enabled)).setter(setter(Builder::enabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Enabled").build()).build();
private static final SdkField REPLACE_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.getter(getter(UpdateMaintenanceWindowRequest::replace)).setter(setter(Builder::replace))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Replace").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(WINDOW_ID_FIELD, NAME_FIELD,
DESCRIPTION_FIELD, START_DATE_FIELD, END_DATE_FIELD, SCHEDULE_FIELD, SCHEDULE_TIMEZONE_FIELD, DURATION_FIELD,
CUTOFF_FIELD, ALLOW_UNASSOCIATED_TARGETS_FIELD, ENABLED_FIELD, REPLACE_FIELD));
private final String windowId;
private final String name;
private final String description;
private final String startDate;
private final String endDate;
private final String schedule;
private final String scheduleTimezone;
private final Integer duration;
private final Integer cutoff;
private final Boolean allowUnassociatedTargets;
private final Boolean enabled;
private final Boolean replace;
private UpdateMaintenanceWindowRequest(BuilderImpl builder) {
super(builder);
this.windowId = builder.windowId;
this.name = builder.name;
this.description = builder.description;
this.startDate = builder.startDate;
this.endDate = builder.endDate;
this.schedule = builder.schedule;
this.scheduleTimezone = builder.scheduleTimezone;
this.duration = builder.duration;
this.cutoff = builder.cutoff;
this.allowUnassociatedTargets = builder.allowUnassociatedTargets;
this.enabled = builder.enabled;
this.replace = builder.replace;
}
/**
*
* The ID of the maintenance window to update.
*
*
* @return The ID of the maintenance window to update.
*/
public String windowId() {
return windowId;
}
/**
*
* The name of the maintenance window.
*
*
* @return The name of the maintenance window.
*/
public String name() {
return name;
}
/**
*
* An optional description for the update request.
*
*
* @return An optional description for the update request.
*/
public String description() {
return description;
}
/**
*
* The time zone that the scheduled maintenance window executions are based on, in Internet Assigned Numbers
* Authority (IANA) format. For example: "America/Los_Angeles", "etc/UTC", or "Asia/Seoul". For more information,
* see the Time Zone Database on the IANA website.
*
*
* @return The time zone that the scheduled maintenance window executions are based on, in Internet Assigned Numbers
* Authority (IANA) format. For example: "America/Los_Angeles", "etc/UTC", or "Asia/Seoul". For more
* information, see the Time Zone Database on the IANA
* website.
*/
public String startDate() {
return startDate;
}
/**
*
* The date and time, in ISO-8601 Extended format, for when you want the maintenance window to become inactive.
* EndDate allows you to set a date and time in the future when the maintenance window will no longer run.
*
*
* @return The date and time, in ISO-8601 Extended format, for when you want the maintenance window to become
* inactive. EndDate allows you to set a date and time in the future when the maintenance window will no
* longer run.
*/
public String endDate() {
return endDate;
}
/**
*
* The schedule of the maintenance window in the form of a cron or rate expression.
*
*
* @return The schedule of the maintenance window in the form of a cron or rate expression.
*/
public String schedule() {
return schedule;
}
/**
*
* The time zone that the scheduled maintenance window executions are based on, in Internet Assigned Numbers
* Authority (IANA) format. For example: "America/Los_Angeles", "etc/UTC", or "Asia/Seoul". For more information,
* see the Time Zone Database on the IANA website.
*
*
* @return The time zone that the scheduled maintenance window executions are based on, in Internet Assigned Numbers
* Authority (IANA) format. For example: "America/Los_Angeles", "etc/UTC", or "Asia/Seoul". For more
* information, see the Time Zone Database on the IANA
* website.
*/
public String scheduleTimezone() {
return scheduleTimezone;
}
/**
*
* The duration of the maintenance window in hours.
*
*
* @return The duration of the maintenance window in hours.
*/
public Integer duration() {
return duration;
}
/**
*
* The number of hours before the end of the maintenance window that Systems Manager stops scheduling new tasks for
* execution.
*
*
* @return The number of hours before the end of the maintenance window that Systems Manager stops scheduling new
* tasks for execution.
*/
public Integer cutoff() {
return cutoff;
}
/**
*
* Whether targets must be registered with the maintenance window before tasks can be defined for those targets.
*
*
* @return Whether targets must be registered with the maintenance window before tasks can be defined for those
* targets.
*/
public Boolean allowUnassociatedTargets() {
return allowUnassociatedTargets;
}
/**
*
* Whether the maintenance window is enabled.
*
*
* @return Whether the maintenance window is enabled.
*/
public Boolean enabled() {
return enabled;
}
/**
*
* If True, then all fields that are required by the CreateMaintenanceWindow action are also required for this API
* request. Optional fields that are not specified are set to null.
*
*
* @return If True, then all fields that are required by the CreateMaintenanceWindow action are also required for
* this API request. Optional fields that are not specified are set to null.
*/
public Boolean replace() {
return replace;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(windowId());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(startDate());
hashCode = 31 * hashCode + Objects.hashCode(endDate());
hashCode = 31 * hashCode + Objects.hashCode(schedule());
hashCode = 31 * hashCode + Objects.hashCode(scheduleTimezone());
hashCode = 31 * hashCode + Objects.hashCode(duration());
hashCode = 31 * hashCode + Objects.hashCode(cutoff());
hashCode = 31 * hashCode + Objects.hashCode(allowUnassociatedTargets());
hashCode = 31 * hashCode + Objects.hashCode(enabled());
hashCode = 31 * hashCode + Objects.hashCode(replace());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof UpdateMaintenanceWindowRequest)) {
return false;
}
UpdateMaintenanceWindowRequest other = (UpdateMaintenanceWindowRequest) obj;
return Objects.equals(windowId(), other.windowId()) && Objects.equals(name(), other.name())
&& Objects.equals(description(), other.description()) && Objects.equals(startDate(), other.startDate())
&& Objects.equals(endDate(), other.endDate()) && Objects.equals(schedule(), other.schedule())
&& Objects.equals(scheduleTimezone(), other.scheduleTimezone()) && Objects.equals(duration(), other.duration())
&& Objects.equals(cutoff(), other.cutoff())
&& Objects.equals(allowUnassociatedTargets(), other.allowUnassociatedTargets())
&& Objects.equals(enabled(), other.enabled()) && Objects.equals(replace(), other.replace());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public String toString() {
return ToString.builder("UpdateMaintenanceWindowRequest").add("WindowId", windowId()).add("Name", name())
.add("Description", description() == null ? null : "*** Sensitive Data Redacted ***")
.add("StartDate", startDate()).add("EndDate", endDate()).add("Schedule", schedule())
.add("ScheduleTimezone", scheduleTimezone()).add("Duration", duration()).add("Cutoff", cutoff())
.add("AllowUnassociatedTargets", allowUnassociatedTargets()).add("Enabled", enabled()).add("Replace", replace())
.build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "WindowId":
return Optional.ofNullable(clazz.cast(windowId()));
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "Description":
return Optional.ofNullable(clazz.cast(description()));
case "StartDate":
return Optional.ofNullable(clazz.cast(startDate()));
case "EndDate":
return Optional.ofNullable(clazz.cast(endDate()));
case "Schedule":
return Optional.ofNullable(clazz.cast(schedule()));
case "ScheduleTimezone":
return Optional.ofNullable(clazz.cast(scheduleTimezone()));
case "Duration":
return Optional.ofNullable(clazz.cast(duration()));
case "Cutoff":
return Optional.ofNullable(clazz.cast(cutoff()));
case "AllowUnassociatedTargets":
return Optional.ofNullable(clazz.cast(allowUnassociatedTargets()));
case "Enabled":
return Optional.ofNullable(clazz.cast(enabled()));
case "Replace":
return Optional.ofNullable(clazz.cast(replace()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function