Class: AWSCDK::Synthetics::CfnCanary::CodeProperty

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

Overview

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 .

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(blueprint_types: nil, dependencies: nil, handler: nil, s3_bucket: nil, s3_key: nil, s3_object_version: nil, script: nil, source_location_arn: nil) ⇒ CodeProperty

Returns a new instance of CodeProperty.

Parameters:

  • blueprint_types (Array<String>, nil) (defaults to: nil)

    BlueprintTypes are a list of templates that enable simplified canary creation.

  • dependencies (AWSCDK::IResolvable, Array<AWSCDK::IResolvable, AWSCDK::Synthetics::CfnCanary::DependencyProperty>, nil) (defaults to: nil)

    List of Lambda layers to attach to the canary.

  • handler (String, nil) (defaults to: nil)

    The entry point to use for the source code when running the canary.

  • s3_bucket (String, nil) (defaults to: nil)

    If your canary script is located in S3, specify the bucket name here.

  • s3_key (String, nil) (defaults to: nil)

    The Amazon S3 key of your script.

  • s3_object_version (String, nil) (defaults to: nil)

    The Amazon S3 version ID of your script.

  • script (String, nil) (defaults to: nil)

    If you input your canary script directly into the canary instead of referring to an S3 location, the value of this parameter is the script in plain text.

  • source_location_arn (String, nil) (defaults to: nil)

    The ARN of the Lambda layer where Synthetics stores the canary script code.



933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
# File 'synthetics/cfn_canary.rb', line 933

def initialize(blueprint_types: nil, dependencies: nil, handler: nil, s3_bucket: nil, s3_key: nil, s3_object_version: nil, script: nil, source_location_arn: nil)
  @blueprint_types = blueprint_types
  Jsii::Type.check_type(@blueprint_types, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "blueprintTypes") unless @blueprint_types.nil?
  @dependencies = dependencies
  Jsii::Type.check_type(@dependencies, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc3ludGhldGljcy5DZm5DYW5hcnkuRGVwZW5kZW5jeVByb3BlcnR5In1dfX0sImtpbmQiOiJhcnJheSJ9fV19fQ==")), "dependencies") unless @dependencies.nil?
  @handler = handler
  Jsii::Type.check_type(@handler, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "handler") unless @handler.nil?
  @s3_bucket = s3_bucket
  Jsii::Type.check_type(@s3_bucket, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "s3Bucket") unless @s3_bucket.nil?
  @s3_key = s3_key
  Jsii::Type.check_type(@s3_key, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "s3Key") unless @s3_key.nil?
  @s3_object_version = s3_object_version
  Jsii::Type.check_type(@s3_object_version, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "s3ObjectVersion") unless @s3_object_version.nil?
  @script = script
  Jsii::Type.check_type(@script, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "script") unless @script.nil?
  @source_location_arn = source_location_arn
  Jsii::Type.check_type(@source_location_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "sourceLocationArn") unless @source_location_arn.nil?
end

Instance Attribute Details

#blueprint_typesArray<String>? (readonly)

BlueprintTypes are a list of templates that enable simplified canary creation.

You can create canaries for common monitoring scenarios by providing only a JSON configuration file instead of writing custom scripts. multi-checks is the only supported value.

When you specify BlueprintTypes , the Handler field cannot be specified since the blueprint provides a pre-defined entry point.



960
961
962
# File 'synthetics/cfn_canary.rb', line 960

def blueprint_types
  @blueprint_types
end

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

List of Lambda layers to attach to the canary.



965
966
967
# File 'synthetics/cfn_canary.rb', line 965

def dependencies
  @dependencies
end

#handlerString? (readonly)

The entry point to use for the source code when running the canary.

For canaries that use the syn-python-selenium-1.0 runtime or a syn-nodejs.puppeteer runtime earlier than syn-nodejs.puppeteer-3.4 , the handler must be specified as *fileName* .handler . For syn-python-selenium-1.1 , syn-nodejs.puppeteer-3.4 , and later runtimes, the handler can be specified as *fileName* . *functionName* , or you can specify a folder where canary scripts reside as *folder* / *fileName* . *functionName* .

This field is required when you don't specify BlueprintTypes and is not allowed when you specify BlueprintTypes .



974
975
976
# File 'synthetics/cfn_canary.rb', line 974

def handler
  @handler
end

#s3_bucketString? (readonly)

If your canary script is located in S3, specify the bucket name here.

The bucket must already exist.



981
982
983
# File 'synthetics/cfn_canary.rb', line 981

def s3_bucket
  @s3_bucket
end

#s3_keyString? (readonly)

The Amazon S3 key of your script.

For more information, see Working with Amazon S3 Objects .



988
989
990
# File 'synthetics/cfn_canary.rb', line 988

def s3_key
  @s3_key
end

#s3_object_versionString? (readonly)

The Amazon S3 version ID of your script.



993
994
995
# File 'synthetics/cfn_canary.rb', line 993

def s3_object_version
  @s3_object_version
end

#scriptString? (readonly)

If you input your canary script directly into the canary instead of referring to an S3 location, the value of this parameter is the script in plain text.

It can be up to 5 MB.



1000
1001
1002
# File 'synthetics/cfn_canary.rb', line 1000

def script
  @script
end

#source_location_arnString? (readonly)

The ARN of the Lambda layer where Synthetics stores the canary script code.



1005
1006
1007
# File 'synthetics/cfn_canary.rb', line 1005

def source_location_arn
  @source_location_arn
end

Class Method Details

.jsii_propertiesObject



1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
# File 'synthetics/cfn_canary.rb', line 1007

def self.jsii_properties
  {
    :blueprint_types => "blueprintTypes",
    :dependencies => "dependencies",
    :handler => "handler",
    :s3_bucket => "s3Bucket",
    :s3_key => "s3Key",
    :s3_object_version => "s3ObjectVersion",
    :script => "script",
    :source_location_arn => "sourceLocationArn",
  }
end

Instance Method Details

#to_jsiiObject



1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
# File 'synthetics/cfn_canary.rb', line 1020

def to_jsii
  result = {}
  result.merge!({
    "blueprintTypes" => @blueprint_types,
    "dependencies" => @dependencies,
    "handler" => @handler,
    "s3Bucket" => @s3_bucket,
    "s3Key" => @s3_key,
    "s3ObjectVersion" => @s3_object_version,
    "script" => @script,
    "sourceLocationArn" => @source_location_arn,
  })
  result.compact
end