
software.amazon.awssdk.services.ssm.model.GetMaintenanceWindowExecutionResponse 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.time.Instant;
import java.util.Arrays;
import java.util.Collection;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
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 GetMaintenanceWindowExecutionResponse extends SsmResponse implements
ToCopyableBuilder {
private static final SdkField WINDOW_EXECUTION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(GetMaintenanceWindowExecutionResponse::windowExecutionId)).setter(setter(Builder::windowExecutionId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("WindowExecutionId").build()).build();
private static final SdkField> TASK_IDS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.getter(getter(GetMaintenanceWindowExecutionResponse::taskIds))
.setter(setter(Builder::taskIds))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TaskIds").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(GetMaintenanceWindowExecutionResponse::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField STATUS_DETAILS_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(GetMaintenanceWindowExecutionResponse::statusDetails)).setter(setter(Builder::statusDetails))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StatusDetails").build()).build();
private static final SdkField START_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(GetMaintenanceWindowExecutionResponse::startTime)).setter(setter(Builder::startTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StartTime").build()).build();
private static final SdkField END_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(GetMaintenanceWindowExecutionResponse::endTime)).setter(setter(Builder::endTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndTime").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(WINDOW_EXECUTION_ID_FIELD,
TASK_IDS_FIELD, STATUS_FIELD, STATUS_DETAILS_FIELD, START_TIME_FIELD, END_TIME_FIELD));
private final String windowExecutionId;
private final List taskIds;
private final String status;
private final String statusDetails;
private final Instant startTime;
private final Instant endTime;
private GetMaintenanceWindowExecutionResponse(BuilderImpl builder) {
super(builder);
this.windowExecutionId = builder.windowExecutionId;
this.taskIds = builder.taskIds;
this.status = builder.status;
this.statusDetails = builder.statusDetails;
this.startTime = builder.startTime;
this.endTime = builder.endTime;
}
/**
*
* The ID of the maintenance window execution.
*
*
* @return The ID of the maintenance window execution.
*/
public String windowExecutionId() {
return windowExecutionId;
}
/**
* Returns true if the TaskIds property was specified by the sender (it may be empty), or false if the sender did
* not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service.
*/
public boolean hasTaskIds() {
return taskIds != null && !(taskIds instanceof SdkAutoConstructList);
}
/**
*
* The ID of the task executions from the maintenance window execution.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasTaskIds()} to see if a value was sent in this field.
*
*
* @return The ID of the task executions from the maintenance window execution.
*/
public List taskIds() {
return taskIds;
}
/**
*
* The status of the maintenance window execution.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link MaintenanceWindowExecutionStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #statusAsString}.
*
*
* @return The status of the maintenance window execution.
* @see MaintenanceWindowExecutionStatus
*/
public MaintenanceWindowExecutionStatus status() {
return MaintenanceWindowExecutionStatus.fromValue(status);
}
/**
*
* The status of the maintenance window execution.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link MaintenanceWindowExecutionStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #statusAsString}.
*
*
* @return The status of the maintenance window execution.
* @see MaintenanceWindowExecutionStatus
*/
public String statusAsString() {
return status;
}
/**
*
* The details explaining the Status. Only available for certain status values.
*
*
* @return The details explaining the Status. Only available for certain status values.
*/
public String statusDetails() {
return statusDetails;
}
/**
*
* The time the maintenance window started running.
*
*
* @return The time the maintenance window started running.
*/
public Instant startTime() {
return startTime;
}
/**
*
* The time the maintenance window finished running.
*
*
* @return The time the maintenance window finished running.
*/
public Instant endTime() {
return endTime;
}
@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(windowExecutionId());
hashCode = 31 * hashCode + Objects.hashCode(taskIds());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(statusDetails());
hashCode = 31 * hashCode + Objects.hashCode(startTime());
hashCode = 31 * hashCode + Objects.hashCode(endTime());
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 GetMaintenanceWindowExecutionResponse)) {
return false;
}
GetMaintenanceWindowExecutionResponse other = (GetMaintenanceWindowExecutionResponse) obj;
return Objects.equals(windowExecutionId(), other.windowExecutionId()) && Objects.equals(taskIds(), other.taskIds())
&& Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(statusDetails(), other.statusDetails()) && Objects.equals(startTime(), other.startTime())
&& Objects.equals(endTime(), other.endTime());
}
/**
* 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("GetMaintenanceWindowExecutionResponse").add("WindowExecutionId", windowExecutionId())
.add("TaskIds", taskIds()).add("Status", statusAsString()).add("StatusDetails", statusDetails())
.add("StartTime", startTime()).add("EndTime", endTime()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "WindowExecutionId":
return Optional.ofNullable(clazz.cast(windowExecutionId()));
case "TaskIds":
return Optional.ofNullable(clazz.cast(taskIds()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "StatusDetails":
return Optional.ofNullable(clazz.cast(statusDetails()));
case "StartTime":
return Optional.ofNullable(clazz.cast(startTime()));
case "EndTime":
return Optional.ofNullable(clazz.cast(endTime()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function