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

software.amazon.awssdk.services.synthetics.model.CreateCanaryRequest 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.synthetics.model;

import java.util.Arrays;
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.LocationTrait;
import software.amazon.awssdk.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
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 CreateCanaryRequest extends SyntheticsRequest implements
        ToCopyableBuilder {
    private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(CreateCanaryRequest::name)).setter(setter(Builder::name))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();

    private static final SdkField CODE_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
            .getter(getter(CreateCanaryRequest::code)).setter(setter(Builder::code)).constructor(CanaryCodeInput::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Code").build()).build();

    private static final SdkField ARTIFACT_S3_LOCATION_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(CreateCanaryRequest::artifactS3Location)).setter(setter(Builder::artifactS3Location))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ArtifactS3Location").build())
            .build();

    private static final SdkField EXECUTION_ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(CreateCanaryRequest::executionRoleArn)).setter(setter(Builder::executionRoleArn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExecutionRoleArn").build()).build();

    private static final SdkField SCHEDULE_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO).getter(getter(CreateCanaryRequest::schedule))
            .setter(setter(Builder::schedule)).constructor(CanaryScheduleInput::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Schedule").build()).build();

    private static final SdkField RUN_CONFIG_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO).getter(getter(CreateCanaryRequest::runConfig))
            .setter(setter(Builder::runConfig)).constructor(CanaryRunConfigInput::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RunConfig").build()).build();

    private static final SdkField SUCCESS_RETENTION_PERIOD_IN_DAYS_FIELD = SdkField
            . builder(MarshallingType.INTEGER)
            .getter(getter(CreateCanaryRequest::successRetentionPeriodInDays))
            .setter(setter(Builder::successRetentionPeriodInDays))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SuccessRetentionPeriodInDays")
                    .build()).build();

    private static final SdkField FAILURE_RETENTION_PERIOD_IN_DAYS_FIELD = SdkField
            . builder(MarshallingType.INTEGER)
            .getter(getter(CreateCanaryRequest::failureRetentionPeriodInDays))
            .setter(setter(Builder::failureRetentionPeriodInDays))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FailureRetentionPeriodInDays")
                    .build()).build();

    private static final SdkField RUNTIME_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(CreateCanaryRequest::runtimeVersion)).setter(setter(Builder::runtimeVersion))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RuntimeVersion").build()).build();

    private static final SdkField VPC_CONFIG_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
            .getter(getter(CreateCanaryRequest::vpcConfig)).setter(setter(Builder::vpcConfig))
            .constructor(VpcConfigInput::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VpcConfig").build()).build();

    private static final SdkField> TAGS_FIELD = SdkField
            .> builder(MarshallingType.MAP)
            .getter(getter(CreateCanaryRequest::tags))
            .setter(setter(Builder::tags))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Tags").build(),
                    MapTrait.builder()
                            .keyLocationName("key")
                            .valueLocationName("value")
                            .valueFieldInfo(
                                    SdkField. builder(MarshallingType.STRING)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("value").build()).build()).build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NAME_FIELD, CODE_FIELD,
            ARTIFACT_S3_LOCATION_FIELD, EXECUTION_ROLE_ARN_FIELD, SCHEDULE_FIELD, RUN_CONFIG_FIELD,
            SUCCESS_RETENTION_PERIOD_IN_DAYS_FIELD, FAILURE_RETENTION_PERIOD_IN_DAYS_FIELD, RUNTIME_VERSION_FIELD,
            VPC_CONFIG_FIELD, TAGS_FIELD));

    private final String name;

    private final CanaryCodeInput code;

    private final String artifactS3Location;

    private final String executionRoleArn;

    private final CanaryScheduleInput schedule;

    private final CanaryRunConfigInput runConfig;

    private final Integer successRetentionPeriodInDays;

    private final Integer failureRetentionPeriodInDays;

    private final String runtimeVersion;

    private final VpcConfigInput vpcConfig;

    private final Map tags;

    private CreateCanaryRequest(BuilderImpl builder) {
        super(builder);
        this.name = builder.name;
        this.code = builder.code;
        this.artifactS3Location = builder.artifactS3Location;
        this.executionRoleArn = builder.executionRoleArn;
        this.schedule = builder.schedule;
        this.runConfig = builder.runConfig;
        this.successRetentionPeriodInDays = builder.successRetentionPeriodInDays;
        this.failureRetentionPeriodInDays = builder.failureRetentionPeriodInDays;
        this.runtimeVersion = builder.runtimeVersion;
        this.vpcConfig = builder.vpcConfig;
        this.tags = builder.tags;
    }

    /**
     * 

* The name for this canary. Be sure to give it a descriptive name that distinguishes it from other canaries in your * account. *

*

* Do not include secrets or proprietary information in your canary names. The canary name makes up part of the * canary ARN, and the ARN is included in outbound calls over the internet. For more information, see Security * Considerations for Synthetics Canaries. *

* * @return The name for this canary. Be sure to give it a descriptive name that distinguishes it from other canaries * in your account.

*

* Do not include secrets or proprietary information in your canary names. The canary name makes up part of * the canary ARN, and the ARN is included in outbound calls over the internet. For more information, see * Security Considerations for Synthetics Canaries. */ public String name() { return name; } /** *

* A structure that includes the entry point from which the canary should start running your script. If the script * is stored in an S3 bucket, the bucket name, key, and version are also included. *

* * @return A structure that includes the entry point from which the canary should start running your script. If the * script is stored in an S3 bucket, the bucket name, key, and version are also included. */ public CanaryCodeInput code() { return code; } /** *

* The location in Amazon S3 where Synthetics stores artifacts from the test runs of this canary. Artifacts include * the log file, screenshots, and HAR files. *

* * @return The location in Amazon S3 where Synthetics stores artifacts from the test runs of this canary. Artifacts * include the log file, screenshots, and HAR files. */ public String artifactS3Location() { return artifactS3Location; } /** *

* The ARN of the IAM role to be used to run the canary. This role must already exist, and must include * lambda.amazonaws.com as a principal in the trust policy. The role must also have the following * permissions: *

*
    *
  • *

    * s3:PutObject *

    *
  • *
  • *

    * s3:GetBucketLocation *

    *
  • *
  • *

    * s3:ListAllMyBuckets *

    *
  • *
  • *

    * cloudwatch:PutMetricData *

    *
  • *
  • *

    * logs:CreateLogGroup *

    *
  • *
  • *

    * logs:CreateLogStream *

    *
  • *
  • *

    * logs:CreateLogStream *

    *
  • *
* * @return The ARN of the IAM role to be used to run the canary. This role must already exist, and must include * lambda.amazonaws.com as a principal in the trust policy. The role must also have the * following permissions:

*
    *
  • *

    * s3:PutObject *

    *
  • *
  • *

    * s3:GetBucketLocation *

    *
  • *
  • *

    * s3:ListAllMyBuckets *

    *
  • *
  • *

    * cloudwatch:PutMetricData *

    *
  • *
  • *

    * logs:CreateLogGroup *

    *
  • *
  • *

    * logs:CreateLogStream *

    *
  • *
  • *

    * logs:CreateLogStream *

    *
  • */ public String executionRoleArn() { return executionRoleArn; } /** *

    * A structure that contains information about how often the canary is to run and when these test runs are to stop. *

    * * @return A structure that contains information about how often the canary is to run and when these test runs are * to stop. */ public CanaryScheduleInput schedule() { return schedule; } /** *

    * A structure that contains the configuration for individual canary runs, such as timeout value. *

    * * @return A structure that contains the configuration for individual canary runs, such as timeout value. */ public CanaryRunConfigInput runConfig() { return runConfig; } /** *

    * The number of days to retain data about successful runs of this canary. If you omit this field, the default of 31 * days is used. The valid range is 1 to 455 days. *

    * * @return The number of days to retain data about successful runs of this canary. If you omit this field, the * default of 31 days is used. The valid range is 1 to 455 days. */ public Integer successRetentionPeriodInDays() { return successRetentionPeriodInDays; } /** *

    * The number of days to retain data about failed runs of this canary. If you omit this field, the default of 31 * days is used. The valid range is 1 to 455 days. *

    * * @return The number of days to retain data about failed runs of this canary. If you omit this field, the default * of 31 days is used. The valid range is 1 to 455 days. */ public Integer failureRetentionPeriodInDays() { return failureRetentionPeriodInDays; } /** *

    * Specifies the runtime version to use for the canary. Currently, the only valid value is syn-1.0. For * more information about runtime versions, see * Canary Runtime Versions. *

    * * @return Specifies the runtime version to use for the canary. Currently, the only valid value is * syn-1.0. For more information about runtime versions, see Canary Runtime Versions. */ public String runtimeVersion() { return runtimeVersion; } /** *

    * If this canary is to test an endpoint in a VPC, this structure contains information about the subnet and security * groups of the VPC endpoint. For more information, see * Running a Canary in a VPC. *

    * * @return If this canary is to test an endpoint in a VPC, this structure contains information about the subnet and * security groups of the VPC endpoint. For more information, see * Running a Canary in a VPC. */ public VpcConfigInput vpcConfig() { return vpcConfig; } /** * 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 SdkAutoConstructMap); } /** *

    * A list of key-value pairs to associate with the canary. You can associate as many as 50 tags with a canary. *

    *

    * Tags can help you organize and categorize your resources. You can also use them to scope user permissions, by * granting a user permission to access or change only the resources that have certain tag values. *

    *

    * 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 A list of key-value pairs to associate with the canary. You can associate as many as 50 tags with a * canary.

    *

    * Tags can help you organize and categorize your resources. You can also use them to scope user * permissions, by granting a user permission to access or change only the resources that have certain tag * values. */ public Map 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(name()); hashCode = 31 * hashCode + Objects.hashCode(code()); hashCode = 31 * hashCode + Objects.hashCode(artifactS3Location()); hashCode = 31 * hashCode + Objects.hashCode(executionRoleArn()); hashCode = 31 * hashCode + Objects.hashCode(schedule()); hashCode = 31 * hashCode + Objects.hashCode(runConfig()); hashCode = 31 * hashCode + Objects.hashCode(successRetentionPeriodInDays()); hashCode = 31 * hashCode + Objects.hashCode(failureRetentionPeriodInDays()); hashCode = 31 * hashCode + Objects.hashCode(runtimeVersion()); hashCode = 31 * hashCode + Objects.hashCode(vpcConfig()); 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 CreateCanaryRequest)) { return false; } CreateCanaryRequest other = (CreateCanaryRequest) obj; return Objects.equals(name(), other.name()) && Objects.equals(code(), other.code()) && Objects.equals(artifactS3Location(), other.artifactS3Location()) && Objects.equals(executionRoleArn(), other.executionRoleArn()) && Objects.equals(schedule(), other.schedule()) && Objects.equals(runConfig(), other.runConfig()) && Objects.equals(successRetentionPeriodInDays(), other.successRetentionPeriodInDays()) && Objects.equals(failureRetentionPeriodInDays(), other.failureRetentionPeriodInDays()) && Objects.equals(runtimeVersion(), other.runtimeVersion()) && Objects.equals(vpcConfig(), other.vpcConfig()) && 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("CreateCanaryRequest").add("Name", name()).add("Code", code()) .add("ArtifactS3Location", artifactS3Location()).add("ExecutionRoleArn", executionRoleArn()) .add("Schedule", schedule()).add("RunConfig", runConfig()) .add("SuccessRetentionPeriodInDays", successRetentionPeriodInDays()) .add("FailureRetentionPeriodInDays", failureRetentionPeriodInDays()).add("RuntimeVersion", runtimeVersion()) .add("VpcConfig", vpcConfig()).add("Tags", tags()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Name": return Optional.ofNullable(clazz.cast(name())); case "Code": return Optional.ofNullable(clazz.cast(code())); case "ArtifactS3Location": return Optional.ofNullable(clazz.cast(artifactS3Location())); case "ExecutionRoleArn": return Optional.ofNullable(clazz.cast(executionRoleArn())); case "Schedule": return Optional.ofNullable(clazz.cast(schedule())); case "RunConfig": return Optional.ofNullable(clazz.cast(runConfig())); case "SuccessRetentionPeriodInDays": return Optional.ofNullable(clazz.cast(successRetentionPeriodInDays())); case "FailureRetentionPeriodInDays": return Optional.ofNullable(clazz.cast(failureRetentionPeriodInDays())); case "RuntimeVersion": return Optional.ofNullable(clazz.cast(runtimeVersion())); case "VpcConfig": return Optional.ofNullable(clazz.cast(vpcConfig())); 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((CreateCanaryRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SyntheticsRequest.Builder, SdkPojo, CopyableBuilder { /** *

    * The name for this canary. Be sure to give it a descriptive name that distinguishes it from other canaries in * your account. *

    *

    * Do not include secrets or proprietary information in your canary names. The canary name makes up part of the * canary ARN, and the ARN is included in outbound calls over the internet. For more information, see Security Considerations for Synthetics Canaries. *

    * * @param name * The name for this canary. Be sure to give it a descriptive name that distinguishes it from other * canaries in your account.

    *

    * Do not include secrets or proprietary information in your canary names. The canary name makes up part * of the canary ARN, and the ARN is included in outbound calls over the internet. For more information, * see Security Considerations for Synthetics Canaries. * @return Returns a reference to this object so that method calls can be chained together. */ Builder name(String name); /** *

    * A structure that includes the entry point from which the canary should start running your script. If the * script is stored in an S3 bucket, the bucket name, key, and version are also included. *

    * * @param code * A structure that includes the entry point from which the canary should start running your script. If * the script is stored in an S3 bucket, the bucket name, key, and version are also included. * @return Returns a reference to this object so that method calls can be chained together. */ Builder code(CanaryCodeInput code); /** *

    * A structure that includes the entry point from which the canary should start running your script. If the * script is stored in an S3 bucket, the bucket name, key, and version are also included. *

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

    * The location in Amazon S3 where Synthetics stores artifacts from the test runs of this canary. Artifacts * include the log file, screenshots, and HAR files. *

    * * @param artifactS3Location * The location in Amazon S3 where Synthetics stores artifacts from the test runs of this canary. * Artifacts include the log file, screenshots, and HAR files. * @return Returns a reference to this object so that method calls can be chained together. */ Builder artifactS3Location(String artifactS3Location); /** *

    * The ARN of the IAM role to be used to run the canary. This role must already exist, and must include * lambda.amazonaws.com as a principal in the trust policy. The role must also have the following * permissions: *

    *
      *
    • *

      * s3:PutObject *

      *
    • *
    • *

      * s3:GetBucketLocation *

      *
    • *
    • *

      * s3:ListAllMyBuckets *

      *
    • *
    • *

      * cloudwatch:PutMetricData *

      *
    • *
    • *

      * logs:CreateLogGroup *

      *
    • *
    • *

      * logs:CreateLogStream *

      *
    • *
    • *

      * logs:CreateLogStream *

      *
    • *
    * * @param executionRoleArn * The ARN of the IAM role to be used to run the canary. This role must already exist, and must include * lambda.amazonaws.com as a principal in the trust policy. The role must also have the * following permissions:

    *
      *
    • *

      * s3:PutObject *

      *
    • *
    • *

      * s3:GetBucketLocation *

      *
    • *
    • *

      * s3:ListAllMyBuckets *

      *
    • *
    • *

      * cloudwatch:PutMetricData *

      *
    • *
    • *

      * logs:CreateLogGroup *

      *
    • *
    • *

      * logs:CreateLogStream *

      *
    • *
    • *

      * logs:CreateLogStream *

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

      * A structure that contains information about how often the canary is to run and when these test runs are to * stop. *

      * * @param schedule * A structure that contains information about how often the canary is to run and when these test runs * are to stop. * @return Returns a reference to this object so that method calls can be chained together. */ Builder schedule(CanaryScheduleInput schedule); /** *

      * A structure that contains information about how often the canary is to run and when these test runs are to * stop. *

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

      * A structure that contains the configuration for individual canary runs, such as timeout value. *

      * * @param runConfig * A structure that contains the configuration for individual canary runs, such as timeout value. * @return Returns a reference to this object so that method calls can be chained together. */ Builder runConfig(CanaryRunConfigInput runConfig); /** *

      * A structure that contains the configuration for individual canary runs, such as timeout value. *

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

      * The number of days to retain data about successful runs of this canary. If you omit this field, the default * of 31 days is used. The valid range is 1 to 455 days. *

      * * @param successRetentionPeriodInDays * The number of days to retain data about successful runs of this canary. If you omit this field, the * default of 31 days is used. The valid range is 1 to 455 days. * @return Returns a reference to this object so that method calls can be chained together. */ Builder successRetentionPeriodInDays(Integer successRetentionPeriodInDays); /** *

      * The number of days to retain data about failed runs of this canary. If you omit this field, the default of 31 * days is used. The valid range is 1 to 455 days. *

      * * @param failureRetentionPeriodInDays * The number of days to retain data about failed runs of this canary. If you omit this field, the * default of 31 days is used. The valid range is 1 to 455 days. * @return Returns a reference to this object so that method calls can be chained together. */ Builder failureRetentionPeriodInDays(Integer failureRetentionPeriodInDays); /** *

      * Specifies the runtime version to use for the canary. Currently, the only valid value is syn-1.0. * For more information about runtime versions, see * Canary Runtime Versions. *

      * * @param runtimeVersion * Specifies the runtime version to use for the canary. Currently, the only valid value is * syn-1.0. For more information about runtime versions, see Canary Runtime Versions. * @return Returns a reference to this object so that method calls can be chained together. */ Builder runtimeVersion(String runtimeVersion); /** *

      * If this canary is to test an endpoint in a VPC, this structure contains information about the subnet and * security groups of the VPC endpoint. For more information, see * Running a Canary in a VPC. *

      * * @param vpcConfig * If this canary is to test an endpoint in a VPC, this structure contains information about the subnet * and security groups of the VPC endpoint. For more information, see Running a Canary in a VPC. * @return Returns a reference to this object so that method calls can be chained together. */ Builder vpcConfig(VpcConfigInput vpcConfig); /** *

      * If this canary is to test an endpoint in a VPC, this structure contains information about the subnet and * security groups of the VPC endpoint. For more information, see * Running a Canary in a VPC. *

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

      * A list of key-value pairs to associate with the canary. You can associate as many as 50 tags with a canary. *

      *

      * Tags can help you organize and categorize your resources. You can also use them to scope user permissions, by * granting a user permission to access or change only the resources that have certain tag values. *

      * * @param tags * A list of key-value pairs to associate with the canary. You can associate as many as 50 tags with a * canary.

      *

      * Tags can help you organize and categorize your resources. You can also use them to scope user * permissions, by granting a user permission to access or change only the resources that have certain * tag values. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Map tags); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends SyntheticsRequest.BuilderImpl implements Builder { private String name; private CanaryCodeInput code; private String artifactS3Location; private String executionRoleArn; private CanaryScheduleInput schedule; private CanaryRunConfigInput runConfig; private Integer successRetentionPeriodInDays; private Integer failureRetentionPeriodInDays; private String runtimeVersion; private VpcConfigInput vpcConfig; private Map tags = DefaultSdkAutoConstructMap.getInstance(); private BuilderImpl() { } private BuilderImpl(CreateCanaryRequest model) { super(model); name(model.name); code(model.code); artifactS3Location(model.artifactS3Location); executionRoleArn(model.executionRoleArn); schedule(model.schedule); runConfig(model.runConfig); successRetentionPeriodInDays(model.successRetentionPeriodInDays); failureRetentionPeriodInDays(model.failureRetentionPeriodInDays); runtimeVersion(model.runtimeVersion); vpcConfig(model.vpcConfig); tags(model.tags); } public final String getName() { return name; } @Override public final Builder name(String name) { this.name = name; return this; } public final void setName(String name) { this.name = name; } public final CanaryCodeInput.Builder getCode() { return code != null ? code.toBuilder() : null; } @Override public final Builder code(CanaryCodeInput code) { this.code = code; return this; } public final void setCode(CanaryCodeInput.BuilderImpl code) { this.code = code != null ? code.build() : null; } public final String getArtifactS3Location() { return artifactS3Location; } @Override public final Builder artifactS3Location(String artifactS3Location) { this.artifactS3Location = artifactS3Location; return this; } public final void setArtifactS3Location(String artifactS3Location) { this.artifactS3Location = artifactS3Location; } public final String getExecutionRoleArn() { return executionRoleArn; } @Override public final Builder executionRoleArn(String executionRoleArn) { this.executionRoleArn = executionRoleArn; return this; } public final void setExecutionRoleArn(String executionRoleArn) { this.executionRoleArn = executionRoleArn; } public final CanaryScheduleInput.Builder getSchedule() { return schedule != null ? schedule.toBuilder() : null; } @Override public final Builder schedule(CanaryScheduleInput schedule) { this.schedule = schedule; return this; } public final void setSchedule(CanaryScheduleInput.BuilderImpl schedule) { this.schedule = schedule != null ? schedule.build() : null; } public final CanaryRunConfigInput.Builder getRunConfig() { return runConfig != null ? runConfig.toBuilder() : null; } @Override public final Builder runConfig(CanaryRunConfigInput runConfig) { this.runConfig = runConfig; return this; } public final void setRunConfig(CanaryRunConfigInput.BuilderImpl runConfig) { this.runConfig = runConfig != null ? runConfig.build() : null; } public final Integer getSuccessRetentionPeriodInDays() { return successRetentionPeriodInDays; } @Override public final Builder successRetentionPeriodInDays(Integer successRetentionPeriodInDays) { this.successRetentionPeriodInDays = successRetentionPeriodInDays; return this; } public final void setSuccessRetentionPeriodInDays(Integer successRetentionPeriodInDays) { this.successRetentionPeriodInDays = successRetentionPeriodInDays; } public final Integer getFailureRetentionPeriodInDays() { return failureRetentionPeriodInDays; } @Override public final Builder failureRetentionPeriodInDays(Integer failureRetentionPeriodInDays) { this.failureRetentionPeriodInDays = failureRetentionPeriodInDays; return this; } public final void setFailureRetentionPeriodInDays(Integer failureRetentionPeriodInDays) { this.failureRetentionPeriodInDays = failureRetentionPeriodInDays; } public final String getRuntimeVersion() { return runtimeVersion; } @Override public final Builder runtimeVersion(String runtimeVersion) { this.runtimeVersion = runtimeVersion; return this; } public final void setRuntimeVersion(String runtimeVersion) { this.runtimeVersion = runtimeVersion; } public final VpcConfigInput.Builder getVpcConfig() { return vpcConfig != null ? vpcConfig.toBuilder() : null; } @Override public final Builder vpcConfig(VpcConfigInput vpcConfig) { this.vpcConfig = vpcConfig; return this; } public final void setVpcConfig(VpcConfigInput.BuilderImpl vpcConfig) { this.vpcConfig = vpcConfig != null ? vpcConfig.build() : null; } public final Map getTags() { return tags; } @Override public final Builder tags(Map tags) { this.tags = TagMapCopier.copy(tags); return this; } public final void setTags(Map tags) { this.tags = TagMapCopier.copy(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 CreateCanaryRequest build() { return new CreateCanaryRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy