Class: AWSCDK::Synthetics::CfnCanaryProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
synthetics/cfn_canary_props.rb

Overview

Properties for defining a CfnCanary.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(artifact_s3_location:, code:, execution_role_arn:, name:, runtime_version:, schedule:, artifact_config: nil, browser_configs: nil, delete_lambda_resources_on_canary_deletion: nil, dry_run_and_update: nil, failure_retention_period: nil, provisioned_resource_cleanup: nil, resources_to_replicate_tags: nil, run_config: nil, start_canary_after_creation: nil, success_retention_period: nil, tags: nil, visual_reference: nil, visual_references: nil, vpc_config: nil) ⇒ CfnCanaryProps

Returns a new instance of CfnCanaryProps.

Parameters:



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'synthetics/cfn_canary_props.rb', line 29

def initialize(artifact_s3_location:, code:, execution_role_arn:, name:, runtime_version:, schedule:, artifact_config: nil, browser_configs: nil, delete_lambda_resources_on_canary_deletion: nil, dry_run_and_update: nil, failure_retention_period: nil, provisioned_resource_cleanup: nil, resources_to_replicate_tags: nil, run_config: nil, start_canary_after_creation: nil, success_retention_period: nil, tags: nil, visual_reference: nil, visual_references: nil, vpc_config: nil)
  @artifact_s3_location = artifact_s3_location
  Jsii::Type.check_type(@artifact_s3_location, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "artifactS3Location")
  @code = code.is_a?(Hash) ? ::AWSCDK::Synthetics::CfnCanary::CodeProperty.new(**code.transform_keys(&:to_sym)) : code
  Jsii::Type.check_type(@code, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19zeW50aGV0aWNzLkNmbkNhbmFyeS5Db2RlUHJvcGVydHkifV19fQ==")), "code")
  @execution_role_arn = execution_role_arn
  Jsii::Type.check_type(@execution_role_arn, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoic3RyaW5nIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19pYW0uSVJvbGVSZWYifV19fQ==")), "executionRoleArn")
  @name = name
  Jsii::Type.check_type(@name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "name")
  @runtime_version = runtime_version
  Jsii::Type.check_type(@runtime_version, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "runtimeVersion")
  @schedule = schedule.is_a?(Hash) ? ::AWSCDK::Synthetics::CfnCanary::ScheduleProperty.new(**schedule.transform_keys(&:to_sym)) : schedule
  Jsii::Type.check_type(@schedule, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19zeW50aGV0aWNzLkNmbkNhbmFyeS5TY2hlZHVsZVByb3BlcnR5In1dfX0=")), "schedule")
  @artifact_config = artifact_config.is_a?(Hash) ? ::AWSCDK::Synthetics::CfnCanary::ArtifactConfigProperty.new(**artifact_config.transform_keys(&:to_sym)) : artifact_config
  Jsii::Type.check_type(@artifact_config, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19zeW50aGV0aWNzLkNmbkNhbmFyeS5BcnRpZmFjdENvbmZpZ1Byb3BlcnR5In1dfX0=")), "artifactConfig") unless @artifact_config.nil?
  @browser_configs = browser_configs
  Jsii::Type.check_type(@browser_configs, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc3ludGhldGljcy5DZm5DYW5hcnkuQnJvd3NlckNvbmZpZ1Byb3BlcnR5In1dfX0sImtpbmQiOiJhcnJheSJ9fV19fQ==")), "browserConfigs") unless @browser_configs.nil?
  @delete_lambda_resources_on_canary_deletion = delete_lambda_resources_on_canary_deletion
  Jsii::Type.check_type(@delete_lambda_resources_on_canary_deletion, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "deleteLambdaResourcesOnCanaryDeletion") unless @delete_lambda_resources_on_canary_deletion.nil?
  @dry_run_and_update = dry_run_and_update
  Jsii::Type.check_type(@dry_run_and_update, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "dryRunAndUpdate") unless @dry_run_and_update.nil?
  @failure_retention_period = failure_retention_period
  Jsii::Type.check_type(@failure_retention_period, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "failureRetentionPeriod") unless @failure_retention_period.nil?
  @provisioned_resource_cleanup = provisioned_resource_cleanup
  Jsii::Type.check_type(@provisioned_resource_cleanup, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "provisionedResourceCleanup") unless @provisioned_resource_cleanup.nil?
  @resources_to_replicate_tags = resources_to_replicate_tags
  Jsii::Type.check_type(@resources_to_replicate_tags, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "resourcesToReplicateTags") unless @resources_to_replicate_tags.nil?
  @run_config = run_config.is_a?(Hash) ? ::AWSCDK::Synthetics::CfnCanary::RunConfigProperty.new(**run_config.transform_keys(&:to_sym)) : run_config
  Jsii::Type.check_type(@run_config, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19zeW50aGV0aWNzLkNmbkNhbmFyeS5SdW5Db25maWdQcm9wZXJ0eSJ9XX19")), "runConfig") unless @run_config.nil?
  @start_canary_after_creation = start_canary_after_creation
  Jsii::Type.check_type(@start_canary_after_creation, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "startCanaryAfterCreation") unless @start_canary_after_creation.nil?
  @success_retention_period = success_retention_period
  Jsii::Type.check_type(@success_retention_period, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "successRetentionPeriod") unless @success_retention_period.nil?
  @tags = tags.is_a?(Array) ? tags.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::CfnTag.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : tags
  Jsii::Type.check_type(@tags, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLkNmblRhZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "tags") unless @tags.nil?
  @visual_reference = visual_reference.is_a?(Hash) ? ::AWSCDK::Synthetics::CfnCanary::VisualReferenceProperty.new(**visual_reference.transform_keys(&:to_sym)) : visual_reference
  Jsii::Type.check_type(@visual_reference, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19zeW50aGV0aWNzLkNmbkNhbmFyeS5WaXN1YWxSZWZlcmVuY2VQcm9wZXJ0eSJ9XX19")), "visualReference") unless @visual_reference.nil?
  @visual_references = visual_references
  Jsii::Type.check_type(@visual_references, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc3ludGhldGljcy5DZm5DYW5hcnkuVmlzdWFsUmVmZXJlbmNlUHJvcGVydHkifV19fSwia2luZCI6ImFycmF5In19XX19")), "visualReferences") unless @visual_references.nil?
  @vpc_config = vpc_config.is_a?(Hash) ? ::AWSCDK::Synthetics::CfnCanary::VPCConfigProperty.new(**vpc_config.transform_keys(&:to_sym)) : vpc_config
  Jsii::Type.check_type(@vpc_config, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19zeW50aGV0aWNzLkNmbkNhbmFyeS5WUENDb25maWdQcm9wZXJ0eSJ9XX19")), "vpcConfig") unless @vpc_config.nil?
end

Instance Attribute Details

#artifact_configAWSCDK::IResolvable, ... (readonly)

A structure that contains the configuration for canary artifacts, including the encryption-at-rest settings for artifacts that the canary uploads to Amazon S3.



126
127
128
# File 'synthetics/cfn_canary_props.rb', line 126

def artifact_config
  @artifact_config
end

#artifact_s3_locationString (readonly)

The location in Amazon S3 where Synthetics stores artifacts from the runs of this canary.

Artifacts include the log file, screenshots, and HAR files. Specify the full location path, including s3:// at the beginning of the path.



78
79
80
# File 'synthetics/cfn_canary_props.rb', line 78

def artifact_s3_location
  @artifact_s3_location
end

#browser_configsAWSCDK::IResolvable, ... (readonly)

A structure that specifies the browser type to use for a canary run.

CloudWatch Synthetics supports running canaries on both CHROME and FIREFOX browsers.

If not specified, browser_configs defaults to Chrome.



135
136
137
# File 'synthetics/cfn_canary_props.rb', line 135

def browser_configs
  @browser_configs
end

#codeAWSCDK::IResolvable, AWSCDK::Synthetics::CfnCanary::CodeProperty (readonly)

Use this structure to input your script code for the canary.

This structure contains the Lambda handler with the location where the canary should start running the script. If the script is stored in an S3 bucket, the bucket name, key, and version are also included. If the script is passed into the canary directly, the script code is contained in the value of Script .



85
86
87
# File 'synthetics/cfn_canary_props.rb', line 85

def code
  @code
end

#delete_lambda_resources_on_canary_deletionBoolean, ... (readonly)

Deprecated.

this property has been deprecated

Deletes associated lambda resources created by Synthetics if set to True.

Default is False



143
144
145
# File 'synthetics/cfn_canary_props.rb', line 143

def delete_lambda_resources_on_canary_deletion
  @delete_lambda_resources_on_canary_deletion
end

#dry_run_and_updateBoolean, ... (readonly)

Specifies whether to perform a dry run before updating the canary.

If set to true , CloudFormation will execute a dry run to validate the changes before applying them to the canary. If the dry run succeeds, the canary will be updated with the changes. If the dry run fails, the CloudFormation deployment will fail with the dry run’s failure reason.

If set to false or omitted, the canary will be updated directly without first performing a dry run. The default value is false .

For more information, see Performing safe canary updates .



154
155
156
# File 'synthetics/cfn_canary_props.rb', line 154

def dry_run_and_update
  @dry_run_and_update
end

#execution_role_arnString, AWSCDK::Interfaces::AWSIAM::IRoleRef (readonly)

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:PutLogEvents


100
101
102
# File 'synthetics/cfn_canary_props.rb', line 100

def execution_role_arn
  @execution_role_arn
end

#failure_retention_periodNumeric? (readonly)

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.

This setting affects the range of information returned by GetCanaryRuns , as well as the range of information displayed in the Synthetics console.



163
164
165
# File 'synthetics/cfn_canary_props.rb', line 163

def failure_retention_period
  @failure_retention_period
end

#nameString (readonly)

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 .



109
110
111
# File 'synthetics/cfn_canary_props.rb', line 109

def name
  @name
end

#provisioned_resource_cleanupString? (readonly)

Specifies whether to also delete the Lambda functions and layers used by this canary when the canary is deleted.

If it is AUTOMATIC , the Lambda functions and layers will be deleted when the canary is deleted.

If the value of this parameter is OFF , then the value of the DeleteLambda parameter of the DeleteCanary operation determines whether the Lambda functions and layers will be deleted.



172
173
174
# File 'synthetics/cfn_canary_props.rb', line 172

def provisioned_resource_cleanup
  @provisioned_resource_cleanup
end

#resources_to_replicate_tagsArray<String>? (readonly)

To have the tags that you apply to this canary also be applied to the Lambda function that the canary uses, specify this property with the value lambda-function .

If you do this, CloudWatch Synthetics will keep the tags of the canary and the Lambda function synchronized. Any future changes you make to the canary's tags will also be applied to the function.



179
180
181
# File 'synthetics/cfn_canary_props.rb', line 179

def resources_to_replicate_tags
  @resources_to_replicate_tags
end

#run_configAWSCDK::IResolvable, ... (readonly)

A structure that contains input information for a canary run.

If you omit this structure, the frequency of the canary is used as canary's timeout value, up to a maximum of 900 seconds.



186
187
188
# File 'synthetics/cfn_canary_props.rb', line 186

def run_config
  @run_config
end

#runtime_versionString (readonly)

Specifies the runtime version to use for the canary.

For more information about runtime versions, see Canary Runtime Versions .



116
117
118
# File 'synthetics/cfn_canary_props.rb', line 116

def runtime_version
  @runtime_version
end

#scheduleAWSCDK::IResolvable, AWSCDK::Synthetics::CfnCanary::ScheduleProperty (readonly)

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



121
122
123
# File 'synthetics/cfn_canary_props.rb', line 121

def schedule
  @schedule
end

#start_canary_after_creationBoolean, ... (readonly)

Specify TRUE to have the canary start making runs immediately after it is created.

A canary that you create using CloudFormation can't be used to monitor the CloudFormation stack that creates the canary or to roll back that stack if there is a failure.



193
194
195
# File 'synthetics/cfn_canary_props.rb', line 193

def start_canary_after_creation
  @start_canary_after_creation
end

#success_retention_periodNumeric? (readonly)

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.

This setting affects the range of information returned by GetCanaryRuns , as well as the range of information displayed in the Synthetics console.



202
203
204
# File 'synthetics/cfn_canary_props.rb', line 202

def success_retention_period
  @success_retention_period
end

#tagsArray<AWSCDK::CfnTag>? (readonly)

The list of key-value pairs that are associated with the canary.



207
208
209
# File 'synthetics/cfn_canary_props.rb', line 207

def tags
  @tags
end

#visual_referenceAWSCDK::IResolvable, ... (readonly)

Deprecated.

this property has been deprecated



211
212
213
# File 'synthetics/cfn_canary_props.rb', line 211

def visual_reference
  @visual_reference
end

#visual_referencesAWSCDK::IResolvable, ... (readonly)

A list of visual reference configurations for the canary, one for each browser type that the canary is configured to run on.

Visual references are used for visual monitoring comparisons.

syn-nodejs-puppeteer-11.0 and above, and syn-nodejs-playwright-3.0 and above, only supports visual_references . visual_reference field is not supported.

Versions older than syn-nodejs-puppeteer-11.0 supports both visual_reference and visual_references for backward compatibility. It is recommended to use visual_references for consistency and future compatibility.



222
223
224
# File 'synthetics/cfn_canary_props.rb', line 222

def visual_references
  @visual_references
end

#vpc_configAWSCDK::IResolvable, ... (readonly)

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 .



229
230
231
# File 'synthetics/cfn_canary_props.rb', line 229

def vpc_config
  @vpc_config
end

Class Method Details

.jsii_propertiesObject



231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
# File 'synthetics/cfn_canary_props.rb', line 231

def self.jsii_properties
  {
    :artifact_s3_location => "artifactS3Location",
    :code => "code",
    :execution_role_arn => "executionRoleArn",
    :name => "name",
    :runtime_version => "runtimeVersion",
    :schedule => "schedule",
    :artifact_config => "artifactConfig",
    :browser_configs => "browserConfigs",
    :delete_lambda_resources_on_canary_deletion => "deleteLambdaResourcesOnCanaryDeletion",
    :dry_run_and_update => "dryRunAndUpdate",
    :failure_retention_period => "failureRetentionPeriod",
    :provisioned_resource_cleanup => "provisionedResourceCleanup",
    :resources_to_replicate_tags => "resourcesToReplicateTags",
    :run_config => "runConfig",
    :start_canary_after_creation => "startCanaryAfterCreation",
    :success_retention_period => "successRetentionPeriod",
    :tags => "tags",
    :visual_reference => "visualReference",
    :visual_references => "visualReferences",
    :vpc_config => "vpcConfig",
  }
end

Instance Method Details

#to_jsiiObject



256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
# File 'synthetics/cfn_canary_props.rb', line 256

def to_jsii
  result = {}
  result.merge!({
    "artifactS3Location" => @artifact_s3_location,
    "code" => @code,
    "executionRoleArn" => @execution_role_arn,
    "name" => @name,
    "runtimeVersion" => @runtime_version,
    "schedule" => @schedule,
    "artifactConfig" => @artifact_config,
    "browserConfigs" => @browser_configs,
    "deleteLambdaResourcesOnCanaryDeletion" => @delete_lambda_resources_on_canary_deletion,
    "dryRunAndUpdate" => @dry_run_and_update,
    "failureRetentionPeriod" => @failure_retention_period,
    "provisionedResourceCleanup" => @provisioned_resource_cleanup,
    "resourcesToReplicateTags" => @resources_to_replicate_tags,
    "runConfig" => @run_config,
    "startCanaryAfterCreation" => @start_canary_after_creation,
    "successRetentionPeriod" => @success_retention_period,
    "tags" => @tags,
    "visualReference" => @visual_reference,
    "visualReferences" => @visual_references,
    "vpcConfig" => @vpc_config,
  })
  result.compact
end