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

software.amazon.awssdk.services.ssm.model.StartAutomationExecutionRequest 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.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 java.util.stream.Collectors;
import java.util.stream.Stream;
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.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
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 StartAutomationExecutionRequest extends SsmRequest implements
        ToCopyableBuilder {
    private static final SdkField DOCUMENT_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("DocumentName").getter(getter(StartAutomationExecutionRequest::documentName))
            .setter(setter(Builder::documentName))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DocumentName").build()).build();

    private static final SdkField DOCUMENT_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("DocumentVersion").getter(getter(StartAutomationExecutionRequest::documentVersion))
            .setter(setter(Builder::documentVersion))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DocumentVersion").build()).build();

    private static final SdkField>> PARAMETERS_FIELD = SdkField
            .>> builder(MarshallingType.MAP)
            .memberName("Parameters")
            .getter(getter(StartAutomationExecutionRequest::parameters))
            .setter(setter(Builder::parameters))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Parameters").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 SdkField CLIENT_TOKEN_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("ClientToken").getter(getter(StartAutomationExecutionRequest::clientToken))
            .setter(setter(Builder::clientToken))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ClientToken").build()).build();

    private static final SdkField MODE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Mode")
            .getter(getter(StartAutomationExecutionRequest::modeAsString)).setter(setter(Builder::mode))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Mode").build()).build();

    private static final SdkField TARGET_PARAMETER_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("TargetParameterName").getter(getter(StartAutomationExecutionRequest::targetParameterName))
            .setter(setter(Builder::targetParameterName))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TargetParameterName").build())
            .build();

    private static final SdkField> TARGETS_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("Targets")
            .getter(getter(StartAutomationExecutionRequest::targets))
            .setter(setter(Builder::targets))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Targets").build(),
                    ListTrait
                            .builder()
                            .memberLocationName(null)
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.SDK_POJO)
                                            .constructor(Target::builder)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("member").build()).build()).build()).build();

    private static final SdkField>>> TARGET_MAPS_FIELD = SdkField
            .>>> builder(MarshallingType.LIST)
            .memberName("TargetMaps")
            .getter(getter(StartAutomationExecutionRequest::targetMaps))
            .setter(setter(Builder::targetMaps))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TargetMaps").build(),
                    ListTrait
                            .builder()
                            .memberLocationName(null)
                            .memberFieldInfo(
                                    SdkField.>> builder(MarshallingType.MAP)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("member").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()).build()).build();

    private static final SdkField MAX_CONCURRENCY_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("MaxConcurrency").getter(getter(StartAutomationExecutionRequest::maxConcurrency))
            .setter(setter(Builder::maxConcurrency))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MaxConcurrency").build()).build();

    private static final SdkField MAX_ERRORS_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("MaxErrors").getter(getter(StartAutomationExecutionRequest::maxErrors))
            .setter(setter(Builder::maxErrors))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MaxErrors").build()).build();

    private static final SdkField> TARGET_LOCATIONS_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("TargetLocations")
            .getter(getter(StartAutomationExecutionRequest::targetLocations))
            .setter(setter(Builder::targetLocations))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TargetLocations").build(),
                    ListTrait
                            .builder()
                            .memberLocationName(null)
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.SDK_POJO)
                                            .constructor(TargetLocation::builder)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("member").build()).build()).build()).build();

    private static final SdkField> TAGS_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("Tags")
            .getter(getter(StartAutomationExecutionRequest::tags))
            .setter(setter(Builder::tags))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Tags").build(),
                    ListTrait
                            .builder()
                            .memberLocationName(null)
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.SDK_POJO)
                                            .constructor(Tag::builder)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("member").build()).build()).build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DOCUMENT_NAME_FIELD,
            DOCUMENT_VERSION_FIELD, PARAMETERS_FIELD, CLIENT_TOKEN_FIELD, MODE_FIELD, TARGET_PARAMETER_NAME_FIELD, TARGETS_FIELD,
            TARGET_MAPS_FIELD, MAX_CONCURRENCY_FIELD, MAX_ERRORS_FIELD, TARGET_LOCATIONS_FIELD, TAGS_FIELD));

    private final String documentName;

    private final String documentVersion;

    private final Map> parameters;

    private final String clientToken;

    private final String mode;

    private final String targetParameterName;

    private final List targets;

    private final List>> targetMaps;

    private final String maxConcurrency;

    private final String maxErrors;

    private final List targetLocations;

    private final List tags;

    private StartAutomationExecutionRequest(BuilderImpl builder) {
        super(builder);
        this.documentName = builder.documentName;
        this.documentVersion = builder.documentVersion;
        this.parameters = builder.parameters;
        this.clientToken = builder.clientToken;
        this.mode = builder.mode;
        this.targetParameterName = builder.targetParameterName;
        this.targets = builder.targets;
        this.targetMaps = builder.targetMaps;
        this.maxConcurrency = builder.maxConcurrency;
        this.maxErrors = builder.maxErrors;
        this.targetLocations = builder.targetLocations;
        this.tags = builder.tags;
    }

    /**
     * 

* The name of the Automation document to use for this execution. *

* * @return The name of the Automation document to use for this execution. */ public String documentName() { return documentName; } /** *

* The version of the Automation document to use for this execution. *

* * @return The version of the Automation document to use for this execution. */ public String documentVersion() { return documentVersion; } /** * Returns true if the Parameters 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 hasParameters() { return parameters != null && !(parameters instanceof SdkAutoConstructMap); } /** *

* A key-value map of execution parameters, which match the declared parameters in the Automation document. *

*

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

*

* You can use {@link #hasParameters()} to see if a value was sent in this field. *

* * @return A key-value map of execution parameters, which match the declared parameters in the Automation document. */ public Map> parameters() { return parameters; } /** *

* User-provided idempotency token. The token must be unique, is case insensitive, enforces the UUID format, and * can't be reused. *

* * @return User-provided idempotency token. The token must be unique, is case insensitive, enforces the UUID format, * and can't be reused. */ public String clientToken() { return clientToken; } /** *

* The execution mode of the automation. Valid modes include the following: Auto and Interactive. The default mode * is Auto. *

*

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

* * @return The execution mode of the automation. Valid modes include the following: Auto and Interactive. The * default mode is Auto. * @see ExecutionMode */ public ExecutionMode mode() { return ExecutionMode.fromValue(mode); } /** *

* The execution mode of the automation. Valid modes include the following: Auto and Interactive. The default mode * is Auto. *

*

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

* * @return The execution mode of the automation. Valid modes include the following: Auto and Interactive. The * default mode is Auto. * @see ExecutionMode */ public String modeAsString() { return mode; } /** *

* The name of the parameter used as the target resource for the rate-controlled execution. Required if you specify * targets. *

* * @return The name of the parameter used as the target resource for the rate-controlled execution. Required if you * specify targets. */ public String targetParameterName() { return targetParameterName; } /** * Returns true if the Targets 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 hasTargets() { return targets != null && !(targets instanceof SdkAutoConstructList); } /** *

* A key-value mapping to target resources. Required if you specify TargetParameterName. *

*

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

*

* You can use {@link #hasTargets()} to see if a value was sent in this field. *

* * @return A key-value mapping to target resources. Required if you specify TargetParameterName. */ public List targets() { return targets; } /** * Returns true if the TargetMaps 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 hasTargetMaps() { return targetMaps != null && !(targetMaps instanceof SdkAutoConstructList); } /** *

* A key-value mapping of document parameters to target resources. Both Targets and TargetMaps cannot be specified * together. *

*

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

*

* You can use {@link #hasTargetMaps()} to see if a value was sent in this field. *

* * @return A key-value mapping of document parameters to target resources. Both Targets and TargetMaps cannot be * specified together. */ public List>> targetMaps() { return targetMaps; } /** *

* The maximum number of targets allowed to run this task in parallel. You can specify a number, such as 10, or a * percentage, such as 10%. The default value is 10. *

* * @return The maximum number of targets allowed to run this task in parallel. You can specify a number, such as 10, * or a percentage, such as 10%. The default value is 10. */ public String maxConcurrency() { return maxConcurrency; } /** *

* The number of errors that are allowed before the system stops running the automation on additional targets. You * can specify either an absolute number of errors, for example 10, or a percentage of the target set, for example * 10%. If you specify 3, for example, the system stops running the automation when the fourth error is received. If * you specify 0, then the system stops running the automation on additional targets after the first error result is * returned. If you run an automation on 50 resources and set max-errors to 10%, then the system stops running the * automation on additional targets when the sixth error is received. *

*

* Executions that are already running an automation when max-errors is reached are allowed to complete, but some of * these executions may fail as well. If you need to ensure that there won't be more than max-errors failed * executions, set max-concurrency to 1 so the executions proceed one at a time. *

* * @return The number of errors that are allowed before the system stops running the automation on additional * targets. You can specify either an absolute number of errors, for example 10, or a percentage of the * target set, for example 10%. If you specify 3, for example, the system stops running the automation when * the fourth error is received. If you specify 0, then the system stops running the automation on * additional targets after the first error result is returned. If you run an automation on 50 resources and * set max-errors to 10%, then the system stops running the automation on additional targets when the sixth * error is received.

*

* Executions that are already running an automation when max-errors is reached are allowed to complete, but * some of these executions may fail as well. If you need to ensure that there won't be more than max-errors * failed executions, set max-concurrency to 1 so the executions proceed one at a time. */ public String maxErrors() { return maxErrors; } /** * Returns true if the TargetLocations 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 hasTargetLocations() { return targetLocations != null && !(targetLocations instanceof SdkAutoConstructList); } /** *

* A location is a combination of AWS Regions and/or AWS accounts where you want to run the Automation. Use this * action to start an Automation in multiple Regions and multiple accounts. For more information, see Running Automation workflows in multiple AWS Regions and accounts in the AWS Systems Manager User * Guide. *

*

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

*

* You can use {@link #hasTargetLocations()} to see if a value was sent in this field. *

* * @return A location is a combination of AWS Regions and/or AWS accounts where you want to run the Automation. Use * this action to start an Automation in multiple Regions and multiple accounts. For more information, see * Running Automation workflows in multiple AWS Regions and accounts in the AWS Systems Manager User * Guide. */ public List targetLocations() { return targetLocations; } /** * Returns true if the Tags 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 hasTags() { return tags != null && !(tags instanceof SdkAutoConstructList); } /** *

* Optional metadata that you assign to a resource. You can specify a maximum of five tags for an automation. Tags * enable you to categorize a resource in different ways, such as by purpose, owner, or environment. For example, * you might want to tag an automation to identify an environment or operating system. In this case, you could * specify the following key name/value pairs: *

*
    *
  • *

    * Key=environment,Value=test *

    *
  • *
  • *

    * Key=OS,Value=Windows *

    *
  • *
* *

* To add tags to an existing patch baseline, use the AddTagsToResource action. *

*
*

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

*

* You can use {@link #hasTags()} to see if a value was sent in this field. *

* * @return Optional metadata that you assign to a resource. You can specify a maximum of five tags for an * automation. Tags enable you to categorize a resource in different ways, such as by purpose, owner, or * environment. For example, you might want to tag an automation to identify an environment or operating * system. In this case, you could specify the following key name/value pairs:

*
    *
  • *

    * Key=environment,Value=test *

    *
  • *
  • *

    * Key=OS,Value=Windows *

    *
  • *
* *

* To add tags to an existing patch baseline, use the AddTagsToResource action. *

*/ public List tags() { return tags; } @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(documentName()); hashCode = 31 * hashCode + Objects.hashCode(documentVersion()); hashCode = 31 * hashCode + Objects.hashCode(parameters()); hashCode = 31 * hashCode + Objects.hashCode(clientToken()); hashCode = 31 * hashCode + Objects.hashCode(modeAsString()); hashCode = 31 * hashCode + Objects.hashCode(targetParameterName()); hashCode = 31 * hashCode + Objects.hashCode(targets()); hashCode = 31 * hashCode + Objects.hashCode(targetMaps()); hashCode = 31 * hashCode + Objects.hashCode(maxConcurrency()); hashCode = 31 * hashCode + Objects.hashCode(maxErrors()); hashCode = 31 * hashCode + Objects.hashCode(targetLocations()); hashCode = 31 * hashCode + Objects.hashCode(tags()); 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 StartAutomationExecutionRequest)) { return false; } StartAutomationExecutionRequest other = (StartAutomationExecutionRequest) obj; return Objects.equals(documentName(), other.documentName()) && Objects.equals(documentVersion(), other.documentVersion()) && Objects.equals(parameters(), other.parameters()) && Objects.equals(clientToken(), other.clientToken()) && Objects.equals(modeAsString(), other.modeAsString()) && Objects.equals(targetParameterName(), other.targetParameterName()) && Objects.equals(targets(), other.targets()) && Objects.equals(targetMaps(), other.targetMaps()) && Objects.equals(maxConcurrency(), other.maxConcurrency()) && Objects.equals(maxErrors(), other.maxErrors()) && Objects.equals(targetLocations(), other.targetLocations()) && Objects.equals(tags(), other.tags()); } /** * 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("StartAutomationExecutionRequest").add("DocumentName", documentName()) .add("DocumentVersion", documentVersion()).add("Parameters", parameters()).add("ClientToken", clientToken()) .add("Mode", modeAsString()).add("TargetParameterName", targetParameterName()).add("Targets", targets()) .add("TargetMaps", targetMaps()).add("MaxConcurrency", maxConcurrency()).add("MaxErrors", maxErrors()) .add("TargetLocations", targetLocations()).add("Tags", tags()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "DocumentName": return Optional.ofNullable(clazz.cast(documentName())); case "DocumentVersion": return Optional.ofNullable(clazz.cast(documentVersion())); case "Parameters": return Optional.ofNullable(clazz.cast(parameters())); case "ClientToken": return Optional.ofNullable(clazz.cast(clientToken())); case "Mode": return Optional.ofNullable(clazz.cast(modeAsString())); case "TargetParameterName": return Optional.ofNullable(clazz.cast(targetParameterName())); case "Targets": return Optional.ofNullable(clazz.cast(targets())); case "TargetMaps": return Optional.ofNullable(clazz.cast(targetMaps())); case "MaxConcurrency": return Optional.ofNullable(clazz.cast(maxConcurrency())); case "MaxErrors": return Optional.ofNullable(clazz.cast(maxErrors())); case "TargetLocations": return Optional.ofNullable(clazz.cast(targetLocations())); case "Tags": return Optional.ofNullable(clazz.cast(tags())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((StartAutomationExecutionRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SsmRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The name of the Automation document to use for this execution. *

* * @param documentName * The name of the Automation document to use for this execution. * @return Returns a reference to this object so that method calls can be chained together. */ Builder documentName(String documentName); /** *

* The version of the Automation document to use for this execution. *

* * @param documentVersion * The version of the Automation document to use for this execution. * @return Returns a reference to this object so that method calls can be chained together. */ Builder documentVersion(String documentVersion); /** *

* A key-value map of execution parameters, which match the declared parameters in the Automation document. *

* * @param parameters * A key-value map of execution parameters, which match the declared parameters in the Automation * document. * @return Returns a reference to this object so that method calls can be chained together. */ Builder parameters(Map> parameters); /** *

* User-provided idempotency token. The token must be unique, is case insensitive, enforces the UUID format, and * can't be reused. *

* * @param clientToken * User-provided idempotency token. The token must be unique, is case insensitive, enforces the UUID * format, and can't be reused. * @return Returns a reference to this object so that method calls can be chained together. */ Builder clientToken(String clientToken); /** *

* The execution mode of the automation. Valid modes include the following: Auto and Interactive. The default * mode is Auto. *

* * @param mode * The execution mode of the automation. Valid modes include the following: Auto and Interactive. The * default mode is Auto. * @see ExecutionMode * @return Returns a reference to this object so that method calls can be chained together. * @see ExecutionMode */ Builder mode(String mode); /** *

* The execution mode of the automation. Valid modes include the following: Auto and Interactive. The default * mode is Auto. *

* * @param mode * The execution mode of the automation. Valid modes include the following: Auto and Interactive. The * default mode is Auto. * @see ExecutionMode * @return Returns a reference to this object so that method calls can be chained together. * @see ExecutionMode */ Builder mode(ExecutionMode mode); /** *

* The name of the parameter used as the target resource for the rate-controlled execution. Required if you * specify targets. *

* * @param targetParameterName * The name of the parameter used as the target resource for the rate-controlled execution. Required if * you specify targets. * @return Returns a reference to this object so that method calls can be chained together. */ Builder targetParameterName(String targetParameterName); /** *

* A key-value mapping to target resources. Required if you specify TargetParameterName. *

* * @param targets * A key-value mapping to target resources. Required if you specify TargetParameterName. * @return Returns a reference to this object so that method calls can be chained together. */ Builder targets(Collection targets); /** *

* A key-value mapping to target resources. Required if you specify TargetParameterName. *

* * @param targets * A key-value mapping to target resources. Required if you specify TargetParameterName. * @return Returns a reference to this object so that method calls can be chained together. */ Builder targets(Target... targets); /** *

* A key-value mapping to target resources. Required if you specify TargetParameterName. *

* This is a convenience that creates an instance of the {@link List.Builder} avoiding the need to * create one manually via {@link List#builder()}. * * When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and its * result is passed to {@link #targets(List)}. * * @param targets * a consumer that will call methods on {@link List.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #targets(List) */ Builder targets(Consumer... targets); /** *

* A key-value mapping of document parameters to target resources. Both Targets and TargetMaps cannot be * specified together. *

* * @param targetMaps * A key-value mapping of document parameters to target resources. Both Targets and TargetMaps cannot be * specified together. * @return Returns a reference to this object so that method calls can be chained together. */ Builder targetMaps(Collection>> targetMaps); /** *

* A key-value mapping of document parameters to target resources. Both Targets and TargetMaps cannot be * specified together. *

* * @param targetMaps * A key-value mapping of document parameters to target resources. Both Targets and TargetMaps cannot be * specified together. * @return Returns a reference to this object so that method calls can be chained together. */ Builder targetMaps(Map>... targetMaps); /** *

* The maximum number of targets allowed to run this task in parallel. You can specify a number, such as 10, or * a percentage, such as 10%. The default value is 10. *

* * @param maxConcurrency * The maximum number of targets allowed to run this task in parallel. You can specify a number, such as * 10, or a percentage, such as 10%. The default value is 10. * @return Returns a reference to this object so that method calls can be chained together. */ Builder maxConcurrency(String maxConcurrency); /** *

* The number of errors that are allowed before the system stops running the automation on additional targets. * You can specify either an absolute number of errors, for example 10, or a percentage of the target set, for * example 10%. If you specify 3, for example, the system stops running the automation when the fourth error is * received. If you specify 0, then the system stops running the automation on additional targets after the * first error result is returned. If you run an automation on 50 resources and set max-errors to 10%, then the * system stops running the automation on additional targets when the sixth error is received. *

*

* Executions that are already running an automation when max-errors is reached are allowed to complete, but * some of these executions may fail as well. If you need to ensure that there won't be more than max-errors * failed executions, set max-concurrency to 1 so the executions proceed one at a time. *

* * @param maxErrors * The number of errors that are allowed before the system stops running the automation on additional * targets. You can specify either an absolute number of errors, for example 10, or a percentage of the * target set, for example 10%. If you specify 3, for example, the system stops running the automation * when the fourth error is received. If you specify 0, then the system stops running the automation on * additional targets after the first error result is returned. If you run an automation on 50 resources * and set max-errors to 10%, then the system stops running the automation on additional targets when the * sixth error is received.

*

* Executions that are already running an automation when max-errors is reached are allowed to complete, * but some of these executions may fail as well. If you need to ensure that there won't be more than * max-errors failed executions, set max-concurrency to 1 so the executions proceed one at a time. * @return Returns a reference to this object so that method calls can be chained together. */ Builder maxErrors(String maxErrors); /** *

* A location is a combination of AWS Regions and/or AWS accounts where you want to run the Automation. Use this * action to start an Automation in multiple Regions and multiple accounts. For more information, see Running Automation workflows in multiple AWS Regions and accounts in the AWS Systems Manager User * Guide. *

* * @param targetLocations * A location is a combination of AWS Regions and/or AWS accounts where you want to run the Automation. * Use this action to start an Automation in multiple Regions and multiple accounts. For more * information, see Running Automation workflows in multiple AWS Regions and accounts in the AWS Systems Manager * User Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder targetLocations(Collection targetLocations); /** *

* A location is a combination of AWS Regions and/or AWS accounts where you want to run the Automation. Use this * action to start an Automation in multiple Regions and multiple accounts. For more information, see Running Automation workflows in multiple AWS Regions and accounts in the AWS Systems Manager User * Guide. *

* * @param targetLocations * A location is a combination of AWS Regions and/or AWS accounts where you want to run the Automation. * Use this action to start an Automation in multiple Regions and multiple accounts. For more * information, see Running Automation workflows in multiple AWS Regions and accounts in the AWS Systems Manager * User Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder targetLocations(TargetLocation... targetLocations); /** *

* A location is a combination of AWS Regions and/or AWS accounts where you want to run the Automation. Use this * action to start an Automation in multiple Regions and multiple accounts. For more information, see Running Automation workflows in multiple AWS Regions and accounts in the AWS Systems Manager User * Guide. *

* This is a convenience that creates an instance of the {@link List.Builder} avoiding the need * to create one manually via {@link List#builder()}. * * When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and * its result is passed to {@link #targetLocations(List)}. * * @param targetLocations * a consumer that will call methods on {@link List.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #targetLocations(List) */ Builder targetLocations(Consumer... targetLocations); /** *

* Optional metadata that you assign to a resource. You can specify a maximum of five tags for an automation. * Tags enable you to categorize a resource in different ways, such as by purpose, owner, or environment. For * example, you might want to tag an automation to identify an environment or operating system. In this case, * you could specify the following key name/value pairs: *

*
    *
  • *

    * Key=environment,Value=test *

    *
  • *
  • *

    * Key=OS,Value=Windows *

    *
  • *
* *

* To add tags to an existing patch baseline, use the AddTagsToResource action. *

*
* * @param tags * Optional metadata that you assign to a resource. You can specify a maximum of five tags for an * automation. Tags enable you to categorize a resource in different ways, such as by purpose, owner, or * environment. For example, you might want to tag an automation to identify an environment or operating * system. In this case, you could specify the following key name/value pairs:

*
    *
  • *

    * Key=environment,Value=test *

    *
  • *
  • *

    * Key=OS,Value=Windows *

    *
  • *
* *

* To add tags to an existing patch baseline, use the AddTagsToResource action. *

* @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Collection tags); /** *

* Optional metadata that you assign to a resource. You can specify a maximum of five tags for an automation. * Tags enable you to categorize a resource in different ways, such as by purpose, owner, or environment. For * example, you might want to tag an automation to identify an environment or operating system. In this case, * you could specify the following key name/value pairs: *

*
    *
  • *

    * Key=environment,Value=test *

    *
  • *
  • *

    * Key=OS,Value=Windows *

    *
  • *
* *

* To add tags to an existing patch baseline, use the AddTagsToResource action. *

*
* * @param tags * Optional metadata that you assign to a resource. You can specify a maximum of five tags for an * automation. Tags enable you to categorize a resource in different ways, such as by purpose, owner, or * environment. For example, you might want to tag an automation to identify an environment or operating * system. In this case, you could specify the following key name/value pairs:

*
    *
  • *

    * Key=environment,Value=test *

    *
  • *
  • *

    * Key=OS,Value=Windows *

    *
  • *
* *

* To add tags to an existing patch baseline, use the AddTagsToResource action. *

* @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Tag... tags); /** *

* Optional metadata that you assign to a resource. You can specify a maximum of five tags for an automation. * Tags enable you to categorize a resource in different ways, such as by purpose, owner, or environment. For * example, you might want to tag an automation to identify an environment or operating system. In this case, * you could specify the following key name/value pairs: *

*
    *
  • *

    * Key=environment,Value=test *

    *
  • *
  • *

    * Key=OS,Value=Windows *

    *
  • *
* *

* To add tags to an existing patch baseline, use the AddTagsToResource action. *

*
This is a convenience that creates an instance of the {@link List.Builder} avoiding the need to * create one manually via {@link List#builder()}. * * When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and its result * is passed to {@link #tags(List)}. * * @param tags * a consumer that will call methods on {@link List.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #tags(List) */ Builder tags(Consumer... tags); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends SsmRequest.BuilderImpl implements Builder { private String documentName; private String documentVersion; private Map> parameters = DefaultSdkAutoConstructMap.getInstance(); private String clientToken; private String mode; private String targetParameterName; private List targets = DefaultSdkAutoConstructList.getInstance(); private List>> targetMaps = DefaultSdkAutoConstructList.getInstance(); private String maxConcurrency; private String maxErrors; private List targetLocations = DefaultSdkAutoConstructList.getInstance(); private List tags = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(StartAutomationExecutionRequest model) { super(model); documentName(model.documentName); documentVersion(model.documentVersion); parameters(model.parameters); clientToken(model.clientToken); mode(model.mode); targetParameterName(model.targetParameterName); targets(model.targets); targetMaps(model.targetMaps); maxConcurrency(model.maxConcurrency); maxErrors(model.maxErrors); targetLocations(model.targetLocations); tags(model.tags); } public final String getDocumentName() { return documentName; } @Override public final Builder documentName(String documentName) { this.documentName = documentName; return this; } public final void setDocumentName(String documentName) { this.documentName = documentName; } public final String getDocumentVersion() { return documentVersion; } @Override public final Builder documentVersion(String documentVersion) { this.documentVersion = documentVersion; return this; } public final void setDocumentVersion(String documentVersion) { this.documentVersion = documentVersion; } public final Map> getParameters() { return parameters; } @Override public final Builder parameters(Map> parameters) { this.parameters = AutomationParameterMapCopier.copy(parameters); return this; } public final void setParameters(Map> parameters) { this.parameters = AutomationParameterMapCopier.copy(parameters); } public final String getClientToken() { return clientToken; } @Override public final Builder clientToken(String clientToken) { this.clientToken = clientToken; return this; } public final void setClientToken(String clientToken) { this.clientToken = clientToken; } public final String getMode() { return mode; } @Override public final Builder mode(String mode) { this.mode = mode; return this; } @Override public final Builder mode(ExecutionMode mode) { this.mode(mode == null ? null : mode.toString()); return this; } public final void setMode(String mode) { this.mode = mode; } public final String getTargetParameterName() { return targetParameterName; } @Override public final Builder targetParameterName(String targetParameterName) { this.targetParameterName = targetParameterName; return this; } public final void setTargetParameterName(String targetParameterName) { this.targetParameterName = targetParameterName; } public final Collection getTargets() { return targets != null ? targets.stream().map(Target::toBuilder).collect(Collectors.toList()) : null; } @Override public final Builder targets(Collection targets) { this.targets = TargetsCopier.copy(targets); return this; } @Override @SafeVarargs public final Builder targets(Target... targets) { targets(Arrays.asList(targets)); return this; } @Override @SafeVarargs public final Builder targets(Consumer... targets) { targets(Stream.of(targets).map(c -> Target.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final void setTargets(Collection targets) { this.targets = TargetsCopier.copyFromBuilder(targets); } public final Collection>> getTargetMaps() { return targetMaps; } @Override public final Builder targetMaps(Collection>> targetMaps) { this.targetMaps = TargetMapsCopier.copy(targetMaps); return this; } @Override @SafeVarargs public final Builder targetMaps(Map>... targetMaps) { targetMaps(Arrays.asList(targetMaps)); return this; } public final void setTargetMaps(Collection>> targetMaps) { this.targetMaps = TargetMapsCopier.copy(targetMaps); } public final String getMaxConcurrency() { return maxConcurrency; } @Override public final Builder maxConcurrency(String maxConcurrency) { this.maxConcurrency = maxConcurrency; return this; } public final void setMaxConcurrency(String maxConcurrency) { this.maxConcurrency = maxConcurrency; } public final String getMaxErrors() { return maxErrors; } @Override public final Builder maxErrors(String maxErrors) { this.maxErrors = maxErrors; return this; } public final void setMaxErrors(String maxErrors) { this.maxErrors = maxErrors; } public final Collection getTargetLocations() { return targetLocations != null ? targetLocations.stream().map(TargetLocation::toBuilder).collect(Collectors.toList()) : null; } @Override public final Builder targetLocations(Collection targetLocations) { this.targetLocations = TargetLocationsCopier.copy(targetLocations); return this; } @Override @SafeVarargs public final Builder targetLocations(TargetLocation... targetLocations) { targetLocations(Arrays.asList(targetLocations)); return this; } @Override @SafeVarargs public final Builder targetLocations(Consumer... targetLocations) { targetLocations(Stream.of(targetLocations).map(c -> TargetLocation.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final void setTargetLocations(Collection targetLocations) { this.targetLocations = TargetLocationsCopier.copyFromBuilder(targetLocations); } public final Collection getTags() { return tags != null ? tags.stream().map(Tag::toBuilder).collect(Collectors.toList()) : null; } @Override public final Builder tags(Collection tags) { this.tags = TagListCopier.copy(tags); return this; } @Override @SafeVarargs public final Builder tags(Tag... tags) { tags(Arrays.asList(tags)); return this; } @Override @SafeVarargs public final Builder tags(Consumer... tags) { tags(Stream.of(tags).map(c -> Tag.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final void setTags(Collection tags) { this.tags = TagListCopier.copyFromBuilder(tags); } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public StartAutomationExecutionRequest build() { return new StartAutomationExecutionRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy