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

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 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 getter(Function g) { return obj -> g.apply((GetMaintenanceWindowExecutionResponse) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SsmResponse.Builder, SdkPojo, CopyableBuilder { /** *

* The ID of the maintenance window execution. *

* * @param windowExecutionId * The ID of the maintenance window execution. * @return Returns a reference to this object so that method calls can be chained together. */ Builder windowExecutionId(String windowExecutionId); /** *

* The ID of the task executions from the maintenance window execution. *

* * @param taskIds * The ID of the task executions from the maintenance window execution. * @return Returns a reference to this object so that method calls can be chained together. */ Builder taskIds(Collection taskIds); /** *

* The ID of the task executions from the maintenance window execution. *

* * @param taskIds * The ID of the task executions from the maintenance window execution. * @return Returns a reference to this object so that method calls can be chained together. */ Builder taskIds(String... taskIds); /** *

* The status of the maintenance window execution. *

* * @param status * The status of the maintenance window execution. * @see MaintenanceWindowExecutionStatus * @return Returns a reference to this object so that method calls can be chained together. * @see MaintenanceWindowExecutionStatus */ Builder status(String status); /** *

* The status of the maintenance window execution. *

* * @param status * The status of the maintenance window execution. * @see MaintenanceWindowExecutionStatus * @return Returns a reference to this object so that method calls can be chained together. * @see MaintenanceWindowExecutionStatus */ Builder status(MaintenanceWindowExecutionStatus status); /** *

* The details explaining the Status. Only available for certain status values. *

* * @param statusDetails * The details explaining the Status. Only available for certain status values. * @return Returns a reference to this object so that method calls can be chained together. */ Builder statusDetails(String statusDetails); /** *

* The time the maintenance window started running. *

* * @param startTime * The time the maintenance window started running. * @return Returns a reference to this object so that method calls can be chained together. */ Builder startTime(Instant startTime); /** *

* The time the maintenance window finished running. *

* * @param endTime * The time the maintenance window finished running. * @return Returns a reference to this object so that method calls can be chained together. */ Builder endTime(Instant endTime); } static final class BuilderImpl extends SsmResponse.BuilderImpl implements Builder { private String windowExecutionId; private List taskIds = DefaultSdkAutoConstructList.getInstance(); private String status; private String statusDetails; private Instant startTime; private Instant endTime; private BuilderImpl() { } private BuilderImpl(GetMaintenanceWindowExecutionResponse model) { super(model); windowExecutionId(model.windowExecutionId); taskIds(model.taskIds); status(model.status); statusDetails(model.statusDetails); startTime(model.startTime); endTime(model.endTime); } public final String getWindowExecutionId() { return windowExecutionId; } @Override public final Builder windowExecutionId(String windowExecutionId) { this.windowExecutionId = windowExecutionId; return this; } public final void setWindowExecutionId(String windowExecutionId) { this.windowExecutionId = windowExecutionId; } public final Collection getTaskIds() { return taskIds; } @Override public final Builder taskIds(Collection taskIds) { this.taskIds = MaintenanceWindowExecutionTaskIdListCopier.copy(taskIds); return this; } @Override @SafeVarargs public final Builder taskIds(String... taskIds) { taskIds(Arrays.asList(taskIds)); return this; } public final void setTaskIds(Collection taskIds) { this.taskIds = MaintenanceWindowExecutionTaskIdListCopier.copy(taskIds); } public final String getStatus() { return status; } @Override public final Builder status(String status) { this.status = status; return this; } @Override public final Builder status(MaintenanceWindowExecutionStatus status) { this.status(status == null ? null : status.toString()); return this; } public final void setStatus(String status) { this.status = status; } public final String getStatusDetails() { return statusDetails; } @Override public final Builder statusDetails(String statusDetails) { this.statusDetails = statusDetails; return this; } public final void setStatusDetails(String statusDetails) { this.statusDetails = statusDetails; } public final Instant getStartTime() { return startTime; } @Override public final Builder startTime(Instant startTime) { this.startTime = startTime; return this; } public final void setStartTime(Instant startTime) { this.startTime = startTime; } public final Instant getEndTime() { return endTime; } @Override public final Builder endTime(Instant endTime) { this.endTime = endTime; return this; } public final void setEndTime(Instant endTime) { this.endTime = endTime; } @Override public GetMaintenanceWindowExecutionResponse build() { return new GetMaintenanceWindowExecutionResponse(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy