Class CanaryProps.Builder
java.lang.Object
software.amazon.awscdk.services.synthetics.CanaryProps.Builder
- All Implemented Interfaces:
software.amazon.jsii.Builder<CanaryProps>
- Enclosing interface:
CanaryProps
@Stability(Stable)
public static final class CanaryProps.Builder
extends Object
implements software.amazon.jsii.Builder<CanaryProps>
A builder for
CanaryProps
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionactiveTracing
(Boolean activeTracing) Sets the value ofCanaryProps.getActiveTracing()
artifactS3EncryptionMode
(ArtifactsEncryptionMode artifactS3EncryptionMode) Sets the value ofCanaryProps.getArtifactS3EncryptionMode()
artifactS3KmsKey
(IKey artifactS3KmsKey) Sets the value ofCanaryProps.getArtifactS3KmsKey()
artifactsBucketLifecycleRules
(List<? extends LifecycleRule> artifactsBucketLifecycleRules) Sets the value ofCanaryProps.getArtifactsBucketLifecycleRules()
artifactsBucketLocation
(ArtifactsBucketLocation artifactsBucketLocation) Sets the value ofCanaryProps.getArtifactsBucketLocation()
build()
Builds the configured instance.canaryName
(String canaryName) Sets the value ofCanaryProps.getCanaryName()
Sets the value ofCanaryProps.getCleanup()
environmentVariables
(Map<String, String> environmentVariables) Sets the value ofCanaryProps.getEnvironmentVariables()
failureRetentionPeriod
(Duration failureRetentionPeriod) Sets the value ofCanaryProps.getFailureRetentionPeriod()
Sets the value ofCanaryProps.getMemory()
Sets the value ofCanaryProps.getRole()
Sets the value ofCanaryProps.getRuntime()
Sets the value ofCanaryProps.getSchedule()
securityGroups
(List<? extends ISecurityGroup> securityGroups) Sets the value ofCanaryProps.getSecurityGroups()
startAfterCreation
(Boolean startAfterCreation) Sets the value ofCanaryProps.getStartAfterCreation()
successRetentionPeriod
(Duration successRetentionPeriod) Sets the value ofCanaryProps.getSuccessRetentionPeriod()
Sets the value ofCanaryProps.getTest()
Sets the value ofCanaryProps.getTimeout()
timeToLive
(Duration timeToLive) Sets the value ofCanaryProps.getTimeToLive()
Sets the value ofCanaryProps.getVpc()
vpcSubnets
(SubnetSelection vpcSubnets) Sets the value ofCanaryProps.getVpcSubnets()
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
runtime
Sets the value ofCanaryProps.getRuntime()
- Parameters:
runtime
- Specify the runtime version to use for the canary. This parameter is required.- Returns:
this
-
test
Sets the value ofCanaryProps.getTest()
- Parameters:
test
- The type of test that you want your canary to run. This parameter is required. UseTest.custom()
to specify the test to run.- Returns:
this
-
activeTracing
Sets the value ofCanaryProps.getActiveTracing()
- Parameters:
activeTracing
- Specifies whether this canary is to use active AWS X-Ray tracing when it runs. Active tracing enables this canary run to be displayed in the ServiceLens and X-Ray service maps even if the canary does not hit an endpoint that has X-Ray tracing enabled. Using X-Ray tracing incurs charges.You can enable active tracing only for canaries that use version
syn-nodejs-2.0
or later for their canary runtime.- Returns:
this
-
artifactS3EncryptionMode
@Stability(Stable) public CanaryProps.Builder artifactS3EncryptionMode(ArtifactsEncryptionMode artifactS3EncryptionMode) Sets the value ofCanaryProps.getArtifactS3EncryptionMode()
- Parameters:
artifactS3EncryptionMode
- Canary Artifacts in S3 encryption mode. Artifact encryption is only supported for canaries that use Synthetics runtime versionsyn-nodejs-puppeteer-3.3
or later.- Returns:
this
-
artifactS3KmsKey
Sets the value ofCanaryProps.getArtifactS3KmsKey()
- Parameters:
artifactS3KmsKey
- The KMS key used to encrypt canary artifacts.- Returns:
this
-
artifactsBucketLifecycleRules
@Stability(Stable) public CanaryProps.Builder artifactsBucketLifecycleRules(List<? extends LifecycleRule> artifactsBucketLifecycleRules) Sets the value ofCanaryProps.getArtifactsBucketLifecycleRules()
- Parameters:
artifactsBucketLifecycleRules
- Lifecycle rules for the generated canary artifact bucket. Has no effect if a bucket is passed toartifactsBucketLocation
. If you pass a bucket toartifactsBucketLocation
, you can add lifecycle rules to the bucket itself.- Returns:
this
-
artifactsBucketLocation
@Stability(Stable) public CanaryProps.Builder artifactsBucketLocation(ArtifactsBucketLocation artifactsBucketLocation) Sets the value ofCanaryProps.getArtifactsBucketLocation()
- Parameters:
artifactsBucketLocation
- The s3 location that stores the data of the canary runs.- Returns:
this
-
canaryName
Sets the value ofCanaryProps.getCanaryName()
- Parameters:
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.
- Returns:
this
-
cleanup
Sets the value ofCanaryProps.getCleanup()
- Parameters:
cleanup
- Specify the underlying resources to be cleaned up when the canary is deleted. UsingCleanup.LAMBDA
will create a Custom Resource to achieve this.- Returns:
this
-
environmentVariables
@Stability(Stable) public CanaryProps.Builder environmentVariables(Map<String, String> environmentVariables) Sets the value ofCanaryProps.getEnvironmentVariables()
- Parameters:
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.- Returns:
this
-
failureRetentionPeriod
@Stability(Stable) public CanaryProps.Builder failureRetentionPeriod(Duration failureRetentionPeriod) Sets the value ofCanaryProps.getFailureRetentionPeriod()
- Parameters:
failureRetentionPeriod
- How many days should failed runs be retained.- Returns:
this
-
memory
Sets the value ofCanaryProps.getMemory()
- Parameters:
memory
- The maximum amount of memory that the canary can use while running. This value must be a multiple of 64 Mib. The range is 960 MiB to 3008 MiB.- Returns:
this
-
role
Sets the value ofCanaryProps.getRole()
- Parameters:
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.
- Returns:
this
-
schedule
Sets the value ofCanaryProps.getSchedule()
- Parameters:
schedule
- Specify the schedule for how often the canary runs. For example, if you setschedule
torate(10 minutes)
, then the canary will run every 10 minutes. You can set the schedule withSchedule.rate(Duration)
(recommended) or you can specify an expression usingSchedule.expression()
.- Returns:
this
-
securityGroups
@Stability(Stable) public CanaryProps.Builder securityGroups(List<? extends ISecurityGroup> securityGroups) Sets the value ofCanaryProps.getSecurityGroups()
- Parameters:
securityGroups
- The list of security groups to associate with the canary's network interfaces. You must providevpc
when using this prop.- Returns:
this
-
startAfterCreation
Sets the value ofCanaryProps.getStartAfterCreation()
- Parameters:
startAfterCreation
- Whether or not the canary should start after creation.- Returns:
this
-
successRetentionPeriod
@Stability(Stable) public CanaryProps.Builder successRetentionPeriod(Duration successRetentionPeriod) Sets the value ofCanaryProps.getSuccessRetentionPeriod()
- Parameters:
successRetentionPeriod
- How many days should successful runs be retained.- Returns:
this
-
timeout
Sets the value ofCanaryProps.getTimeout()
- Parameters:
timeout
- How long the canary is allowed to run before it must stop. You can't set this time to be longer than the frequency of the runs of this canary.The minimum allowed value is 3 seconds. The maximum allowed value is 840 seconds (14 minutes).
- Returns:
this
-
timeToLive
Sets the value ofCanaryProps.getTimeToLive()
- Parameters:
timeToLive
- How long the canary will be in a 'RUNNING' state. For example, if you settimeToLive
to be 1 hour andschedule
to berate(10 minutes)
, your canary will run at 10 minute intervals for an hour, for a total of 6 times.- Returns:
this
-
vpc
Sets the value ofCanaryProps.getVpc()
- Parameters:
vpc
- The VPC where this canary is run. Specify this if the canary needs to access resources in a VPC.- Returns:
this
-
vpcSubnets
Sets the value ofCanaryProps.getVpcSubnets()
- Parameters:
vpcSubnets
- Where to place the network interfaces within the VPC. You must providevpc
when using this prop.- Returns:
this
-
build
Builds the configured instance.- Specified by:
build
in interfacesoftware.amazon.jsii.Builder<CanaryProps>
- Returns:
- a new instance of
CanaryProps
- Throws:
NullPointerException
- if any required attribute was not provided
-