
software.amazon.awssdk.services.ssm.model.UpdateMaintenanceWindowResponse Maven / Gradle / Ivy
/*
* Copyright 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.Function;
import software.amazon.awssdk.annotations.Generated;
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 UpdateMaintenanceWindowResponse extends SsmResponse implements
ToCopyableBuilder {
private static final SdkField WINDOW_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("WindowId").getter(getter(UpdateMaintenanceWindowResponse::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).memberName("Name")
.getter(getter(UpdateMaintenanceWindowResponse::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)
.memberName("Description").getter(getter(UpdateMaintenanceWindowResponse::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)
.memberName("StartDate").getter(getter(UpdateMaintenanceWindowResponse::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)
.memberName("EndDate").getter(getter(UpdateMaintenanceWindowResponse::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)
.memberName("Schedule").getter(getter(UpdateMaintenanceWindowResponse::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)
.memberName("ScheduleTimezone").getter(getter(UpdateMaintenanceWindowResponse::scheduleTimezone))
.setter(setter(Builder::scheduleTimezone))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ScheduleTimezone").build()).build();
private static final SdkField SCHEDULE_OFFSET_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("ScheduleOffset").getter(getter(UpdateMaintenanceWindowResponse::scheduleOffset))
.setter(setter(Builder::scheduleOffset))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ScheduleOffset").build()).build();
private static final SdkField DURATION_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("Duration").getter(getter(UpdateMaintenanceWindowResponse::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)
.memberName("Cutoff").getter(getter(UpdateMaintenanceWindowResponse::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)
.memberName("AllowUnassociatedTargets").getter(getter(UpdateMaintenanceWindowResponse::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)
.memberName("Enabled").getter(getter(UpdateMaintenanceWindowResponse::enabled)).setter(setter(Builder::enabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Enabled").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, SCHEDULE_OFFSET_FIELD,
DURATION_FIELD, CUTOFF_FIELD, ALLOW_UNASSOCIATED_TARGETS_FIELD, ENABLED_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 scheduleOffset;
private final Integer duration;
private final Integer cutoff;
private final Boolean allowUnassociatedTargets;
private final Boolean enabled;
private UpdateMaintenanceWindowResponse(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.scheduleOffset = builder.scheduleOffset;
this.duration = builder.duration;
this.cutoff = builder.cutoff;
this.allowUnassociatedTargets = builder.allowUnassociatedTargets;
this.enabled = builder.enabled;
}
/**
*
* The ID of the created maintenance window.
*
*
* @return The ID of the created maintenance window.
*/
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 of the update.
*
*
* @return An optional description of the update.
*/
public String description() {
return description;
}
/**
*
* The date and time, in ISO-8601 Extended format, for when the maintenance window is scheduled to become active.
* The maintenance window will not run before this specified time.
*
*
* @return The date and time, in ISO-8601 Extended format, for when the maintenance window is scheduled to become
* active. The maintenance window will not run before this specified time.
*/
public String startDate() {
return startDate;
}
/**
*
* The date and time, in ISO-8601 Extended format, for when the maintenance window is scheduled to become inactive.
* The maintenance window will not run after this specified time.
*
*
* @return The date and time, in ISO-8601 Extended format, for when the maintenance window is scheduled to become
* inactive. The maintenance window will not run after this specified time.
*/
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 number of days to wait to run a maintenance window after the scheduled CRON expression date and time.
*
*
* @return The number of days to wait to run a maintenance window after the scheduled CRON expression date and time.
*/
public Integer scheduleOffset() {
return scheduleOffset;
}
/**
*
* 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;
}
@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 + super.hashCode();
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(scheduleOffset());
hashCode = 31 * hashCode + Objects.hashCode(duration());
hashCode = 31 * hashCode + Objects.hashCode(cutoff());
hashCode = 31 * hashCode + Objects.hashCode(allowUnassociatedTargets());
hashCode = 31 * hashCode + Objects.hashCode(enabled());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof UpdateMaintenanceWindowResponse)) {
return false;
}
UpdateMaintenanceWindowResponse other = (UpdateMaintenanceWindowResponse) 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(scheduleOffset(), other.scheduleOffset()) && Objects.equals(duration(), other.duration())
&& Objects.equals(cutoff(), other.cutoff())
&& Objects.equals(allowUnassociatedTargets(), other.allowUnassociatedTargets())
&& Objects.equals(enabled(), other.enabled());
}
/**
* 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("UpdateMaintenanceWindowResponse").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("ScheduleOffset", scheduleOffset()).add("Duration", duration())
.add("Cutoff", cutoff()).add("AllowUnassociatedTargets", allowUnassociatedTargets()).add("Enabled", enabled())
.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 "ScheduleOffset":
return Optional.ofNullable(clazz.cast(scheduleOffset()));
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()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function