Class Canary.Builder

java.lang.Object
software.amazon.awscdk.services.synthetics.Canary.Builder
All Implemented Interfaces:
software.amazon.jsii.Builder<Canary>
Enclosing class:
Canary

@Stability(Stable) public static final class Canary.Builder extends Object implements software.amazon.jsii.Builder<Canary>
A fluent builder for Canary.
  • Method Details

    • create

      @Stability(Stable) public static Canary.Builder create(software.constructs.Construct scope, String id)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      Returns:
      a new instance of Canary.Builder.
    • runtime

      @Stability(Stable) public Canary.Builder runtime(Runtime runtime)
      Specify the runtime version to use for the canary.

      Parameters:
      runtime - Specify the runtime version to use for the canary. This parameter is required.
      Returns:
      this
      See Also:
    • test

      @Stability(Stable) public Canary.Builder test(Test test)
      The type of test that you want your canary to run.

      Use Test.custom() to specify the test to run.

      Parameters:
      test - The type of test that you want your canary to run. This parameter is required.
      Returns:
      this
    • artifactsBucketLifecycleRules

      @Stability(Stable) public Canary.Builder artifactsBucketLifecycleRules(List<? extends LifecycleRule> artifactsBucketLifecycleRules)
      Lifecycle rules for the generated canary artifact bucket.

      Has no effect if a bucket is passed to artifactsBucketLocation. If you pass a bucket to artifactsBucketLocation, you can add lifecycle rules to the bucket itself.

      Default: - no rules applied to the generated bucket.

      Parameters:
      artifactsBucketLifecycleRules - Lifecycle rules for the generated canary artifact bucket. This parameter is required.
      Returns:
      this
    • artifactsBucketLocation

      @Stability(Stable) public Canary.Builder artifactsBucketLocation(ArtifactsBucketLocation artifactsBucketLocation)
      The s3 location that stores the data of the canary runs.

      Default: - A new s3 bucket will be created without a prefix.

      Parameters:
      artifactsBucketLocation - The s3 location that stores the data of the canary runs. This parameter is required.
      Returns:
      this
    • canaryName

      @Stability(Stable) public Canary.Builder canaryName(String canaryName)
      The name of the 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 name. The canary name makes up part of the canary ARN, which is included in outbound calls over the internet.

      Default: - A unique name will be generated from the construct ID

      Parameters:
      canaryName - The name of the canary. This parameter is required.
      Returns:
      this
      See Also:
    • cleanup

      @Stability(Stable) public Canary.Builder cleanup(Cleanup cleanup)
      Specify the underlying resources to be cleaned up when the canary is deleted.

      Using Cleanup.LAMBDA will create a Custom Resource to achieve this.

      Default: Cleanup.NOTHING

      Parameters:
      cleanup - Specify the underlying resources to be cleaned up when the canary is deleted. This parameter is required.
      Returns:
      this
    • environmentVariables

      @Stability(Stable) public Canary.Builder environmentVariables(Map<String,String> environmentVariables)
      Key-value pairs that the Synthetics caches and makes available for your canary scripts.

      Use environment variables to apply configuration changes, such as test and production environment configurations, without changing your Canary script source code.

      Default: - No environment variables.

      Parameters:
      environmentVariables - Key-value pairs that the Synthetics caches and makes available for your canary scripts. This parameter is required.
      Returns:
      this
    • failureRetentionPeriod

      @Stability(Stable) public Canary.Builder failureRetentionPeriod(Duration failureRetentionPeriod)
      How many days should failed runs be retained.

      Default: Duration.days(31)

      Parameters:
      failureRetentionPeriod - How many days should failed runs be retained. This parameter is required.
      Returns:
      this
    • role

      @Stability(Stable) public Canary.Builder role(IRole role)
      Canary execution role.

      This is the role that will be assumed by the canary upon execution. It controls the permissions that the canary will have. The role must be assumable by the AWS Lambda service principal.

      If not supplied, a role will be created with all the required permissions. If you provide a Role, you must add the required permissions.

      Default: - A unique role will be generated for this canary. You can add permissions to roles by calling 'addToRolePolicy'.

      Parameters:
      role - Canary execution role. This parameter is required.
      Returns:
      this
      See Also:
    • schedule

      @Stability(Stable) public Canary.Builder schedule(Schedule schedule)
      Specify the schedule for how often the canary runs.

      For example, if you set schedule to rate(10 minutes), then the canary will run every 10 minutes. You can set the schedule with Schedule.rate(Duration) (recommended) or you can specify an expression using Schedule.expression().

      Default: 'rate(5 minutes)'

      Parameters:
      schedule - Specify the schedule for how often the canary runs. This parameter is required.
      Returns:
      this
    • securityGroups

      @Stability(Stable) public Canary.Builder securityGroups(List<? extends ISecurityGroup> securityGroups)
      The list of security groups to associate with the canary's network interfaces.

      You must provide vpc when using this prop.

      Default: - If the canary is placed within a VPC and a security group is not specified a dedicated security group will be created for this canary.

      Parameters:
      securityGroups - The list of security groups to associate with the canary's network interfaces. This parameter is required.
      Returns:
      this
    • startAfterCreation

      @Stability(Stable) public Canary.Builder startAfterCreation(Boolean startAfterCreation)
      Whether or not the canary should start after creation.

      Default: true

      Parameters:
      startAfterCreation - Whether or not the canary should start after creation. This parameter is required.
      Returns:
      this
    • successRetentionPeriod

      @Stability(Stable) public Canary.Builder successRetentionPeriod(Duration successRetentionPeriod)
      How many days should successful runs be retained.

      Default: Duration.days(31)

      Parameters:
      successRetentionPeriod - How many days should successful runs be retained. This parameter is required.
      Returns:
      this
    • timeToLive

      @Stability(Stable) public Canary.Builder timeToLive(Duration timeToLive)
      How long the canary will be in a 'RUNNING' state.

      For example, if you set timeToLive to be 1 hour and schedule to be rate(10 minutes), your canary will run at 10 minute intervals for an hour, for a total of 6 times.

      Default: - no limit

      Parameters:
      timeToLive - How long the canary will be in a 'RUNNING' state. This parameter is required.
      Returns:
      this
    • vpc

      @Stability(Stable) public Canary.Builder vpc(IVpc vpc)
      The VPC where this canary is run.

      Specify this if the canary needs to access resources in a VPC.

      Default: - Not in VPC

      Parameters:
      vpc - The VPC where this canary is run. This parameter is required.
      Returns:
      this
    • vpcSubnets

      @Stability(Stable) public Canary.Builder vpcSubnets(SubnetSelection vpcSubnets)
      Where to place the network interfaces within the VPC.

      You must provide vpc when using this prop.

      Default: - the Vpc default strategy if not specified

      Parameters:
      vpcSubnets - Where to place the network interfaces within the VPC. This parameter is required.
      Returns:
      this
    • build

      @Stability(Stable) public Canary build()
      Specified by:
      build in interface software.amazon.jsii.Builder<Canary>
      Returns:
      a newly built instance of Canary.