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

software.amazon.awssdk.services.ssm.model.SendAutomationSignalRequest 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.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
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 SendAutomationSignalRequest extends SsmRequest implements
        ToCopyableBuilder {
    private static final SdkField AUTOMATION_EXECUTION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(SendAutomationSignalRequest::automationExecutionId)).setter(setter(Builder::automationExecutionId))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AutomationExecutionId").build())
            .build();

    private static final SdkField SIGNAL_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(SendAutomationSignalRequest::signalTypeAsString)).setter(setter(Builder::signalType))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SignalType").build()).build();

    private static final SdkField>> PAYLOAD_FIELD = SdkField
            .>> builder(MarshallingType.MAP)
            .getter(getter(SendAutomationSignalRequest::payload))
            .setter(setter(Builder::payload))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Payload").build(),
                    MapTrait.builder()
                            .keyLocationName("key")
                            .valueLocationName("value")
                            .valueFieldInfo(
                                    SdkField.> builder(MarshallingType.LIST)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("value").build(),
                                                    ListTrait
                                                            .builder()
                                                            .memberLocationName(null)
                                                            .memberFieldInfo(
                                                                    SdkField. builder(MarshallingType.STRING)
                                                                            .traits(LocationTrait.builder()
                                                                                    .location(MarshallLocation.PAYLOAD)
                                                                                    .locationName("member").build()).build())
                                                            .build()).build()).build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(AUTOMATION_EXECUTION_ID_FIELD,
            SIGNAL_TYPE_FIELD, PAYLOAD_FIELD));

    private final String automationExecutionId;

    private final String signalType;

    private final Map> payload;

    private SendAutomationSignalRequest(BuilderImpl builder) {
        super(builder);
        this.automationExecutionId = builder.automationExecutionId;
        this.signalType = builder.signalType;
        this.payload = builder.payload;
    }

    /**
     * 

* The unique identifier for an existing Automation execution that you want to send the signal to. *

* * @return The unique identifier for an existing Automation execution that you want to send the signal to. */ public String automationExecutionId() { return automationExecutionId; } /** *

* The type of signal to send to an Automation execution. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #signalType} will * return {@link SignalType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #signalTypeAsString}. *

* * @return The type of signal to send to an Automation execution. * @see SignalType */ public SignalType signalType() { return SignalType.fromValue(signalType); } /** *

* The type of signal to send to an Automation execution. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #signalType} will * return {@link SignalType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #signalTypeAsString}. *

* * @return The type of signal to send to an Automation execution. * @see SignalType */ public String signalTypeAsString() { return signalType; } /** *

* The data sent with the signal. The data schema depends on the type of signal used in the request. *

*

* For Approve and Reject signal types, the payload is an optional comment that you can * send with the signal type. For example: *

*

* Comment="Looks good" *

*

* For StartStep and Resume signal types, you must send the name of the Automation step to * start or resume as the payload. For example: *

*

* StepName="step1" *

*

* For the StopStep signal type, you must send the step execution ID as the payload. For example: *

*

* StepExecutionId="97fff367-fc5a-4299-aed8-0123456789ab" *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

* * @return The data sent with the signal. The data schema depends on the type of signal used in the request.

*

* For Approve and Reject signal types, the payload is an optional comment that * you can send with the signal type. For example: *

*

* Comment="Looks good" *

*

* For StartStep and Resume signal types, you must send the name of the Automation * step to start or resume as the payload. For example: *

*

* StepName="step1" *

*

* For the StopStep signal type, you must send the step execution ID as the payload. For * example: *

*

* StepExecutionId="97fff367-fc5a-4299-aed8-0123456789ab" */ public Map> payload() { return payload; } @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 + Objects.hashCode(automationExecutionId()); hashCode = 31 * hashCode + Objects.hashCode(signalTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(payload()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof SendAutomationSignalRequest)) { return false; } SendAutomationSignalRequest other = (SendAutomationSignalRequest) obj; return Objects.equals(automationExecutionId(), other.automationExecutionId()) && Objects.equals(signalTypeAsString(), other.signalTypeAsString()) && Objects.equals(payload(), other.payload()); } /** * 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("SendAutomationSignalRequest").add("AutomationExecutionId", automationExecutionId()) .add("SignalType", signalTypeAsString()).add("Payload", payload()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "AutomationExecutionId": return Optional.ofNullable(clazz.cast(automationExecutionId())); case "SignalType": return Optional.ofNullable(clazz.cast(signalTypeAsString())); case "Payload": return Optional.ofNullable(clazz.cast(payload())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((SendAutomationSignalRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SsmRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The unique identifier for an existing Automation execution that you want to send the signal to. *

* * @param automationExecutionId * The unique identifier for an existing Automation execution that you want to send the signal to. * @return Returns a reference to this object so that method calls can be chained together. */ Builder automationExecutionId(String automationExecutionId); /** *

* The type of signal to send to an Automation execution. *

* * @param signalType * The type of signal to send to an Automation execution. * @see SignalType * @return Returns a reference to this object so that method calls can be chained together. * @see SignalType */ Builder signalType(String signalType); /** *

* The type of signal to send to an Automation execution. *

* * @param signalType * The type of signal to send to an Automation execution. * @see SignalType * @return Returns a reference to this object so that method calls can be chained together. * @see SignalType */ Builder signalType(SignalType signalType); /** *

* The data sent with the signal. The data schema depends on the type of signal used in the request. *

*

* For Approve and Reject signal types, the payload is an optional comment that you * can send with the signal type. For example: *

*

* Comment="Looks good" *

*

* For StartStep and Resume signal types, you must send the name of the Automation * step to start or resume as the payload. For example: *

*

* StepName="step1" *

*

* For the StopStep signal type, you must send the step execution ID as the payload. For example: *

*

* StepExecutionId="97fff367-fc5a-4299-aed8-0123456789ab" *

* * @param payload * The data sent with the signal. The data schema depends on the type of signal used in the request.

*

* For Approve and Reject signal types, the payload is an optional comment that * you can send with the signal type. For example: *

*

* Comment="Looks good" *

*

* For StartStep and Resume signal types, you must send the name of the * Automation step to start or resume as the payload. For example: *

*

* StepName="step1" *

*

* For the StopStep signal type, you must send the step execution ID as the payload. For * example: *

*

* StepExecutionId="97fff367-fc5a-4299-aed8-0123456789ab" * @return Returns a reference to this object so that method calls can be chained together. */ Builder payload(Map> payload); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends SsmRequest.BuilderImpl implements Builder { private String automationExecutionId; private String signalType; private Map> payload = DefaultSdkAutoConstructMap.getInstance(); private BuilderImpl() { } private BuilderImpl(SendAutomationSignalRequest model) { super(model); automationExecutionId(model.automationExecutionId); signalType(model.signalType); payload(model.payload); } public final String getAutomationExecutionId() { return automationExecutionId; } @Override public final Builder automationExecutionId(String automationExecutionId) { this.automationExecutionId = automationExecutionId; return this; } public final void setAutomationExecutionId(String automationExecutionId) { this.automationExecutionId = automationExecutionId; } public final String getSignalTypeAsString() { return signalType; } @Override public final Builder signalType(String signalType) { this.signalType = signalType; return this; } @Override public final Builder signalType(SignalType signalType) { this.signalType(signalType.toString()); return this; } public final void setSignalType(String signalType) { this.signalType = signalType; } public final Map> getPayload() { return payload; } @Override public final Builder payload(Map> payload) { this.payload = AutomationParameterMapCopier.copy(payload); return this; } public final void setPayload(Map> payload) { this.payload = AutomationParameterMapCopier.copy(payload); } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public SendAutomationSignalRequest build() { return new SendAutomationSignalRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy