java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.synthetics.Canary
All Implemented Interfaces:
IResource, IConnectable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.97.0 (build 729de35)", date="2024-04-18T17:54:25.604Z") @Stability(Stable) public class Canary extends Resource implements IConnectable
Define a new Canary.

Example:

 Canary canary = Canary.Builder.create(this, "MyCanary")
         .schedule(Schedule.rate(Duration.minutes(5)))
         .test(Test.custom(CustomTestOptions.builder()
                 .code(Code.fromAsset(join(__dirname, "canary")))
                 .handler("index.handler")
                 .build()))
         .runtime(Runtime.SYNTHETICS_NODEJS_PUPPETEER_6_2)
         .environmentVariables(Map.of(
                 "stage", "prod"))
         .build();
 
  • Constructor Details

    • Canary

      protected Canary(software.amazon.jsii.JsiiObjectRef objRef)
    • Canary

      protected Canary(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • Canary

      @Stability(Stable) public Canary(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CanaryProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props - This parameter is required.
  • Method Details

    • metricDuration

      @Stability(Stable) @NotNull public Metric metricDuration(@Nullable MetricOptions options)
      Measure the Duration of a single canary run, in seconds.

      Default: avg over 5 minutes

      Parameters:
      options -
      • configuration options for the metric.
    • metricDuration

      @Stability(Stable) @NotNull public Metric metricDuration()
      Measure the Duration of a single canary run, in seconds.

      Default: avg over 5 minutes

    • metricFailed

      @Stability(Stable) @NotNull public Metric metricFailed(@Nullable MetricOptions options)
      Measure the number of failed canary runs over a given time period.

      Default: sum over 5 minutes

      Parameters:
      options -
      • configuration options for the metric.
    • metricFailed

      @Stability(Stable) @NotNull public Metric metricFailed()
      Measure the number of failed canary runs over a given time period.

      Default: sum over 5 minutes

    • metricSuccessPercent

      @Stability(Stable) @NotNull public Metric metricSuccessPercent(@Nullable MetricOptions options)
      Measure the percentage of successful canary runs.

      Default: avg over 5 minutes

      Parameters:
      options -
      • configuration options for the metric.
    • metricSuccessPercent

      @Stability(Stable) @NotNull public Metric metricSuccessPercent()
      Measure the percentage of successful canary runs.

      Default: avg over 5 minutes

    • getArtifactsBucket

      @Stability(Stable) @NotNull public IBucket getArtifactsBucket()
      Bucket where data from each canary run is stored.
    • getCanaryId

      @Stability(Stable) @NotNull public String getCanaryId()
      The canary ID.
    • getCanaryName

      @Stability(Stable) @NotNull public String getCanaryName()
      The canary Name.
    • getCanaryState

      @Stability(Stable) @NotNull public String getCanaryState()
      The state of the canary.

      For example, 'RUNNING', 'STOPPED', 'NOT STARTED', or 'ERROR'.

    • getConnections

      @Stability(Stable) @NotNull public Connections getConnections()
      Access the Connections object.

      Will fail if not a VPC-enabled Canary

      Specified by:
      getConnections in interface IConnectable
    • getRole

      @Stability(Stable) @NotNull public IRole getRole()
      Execution role associated with this Canary.