You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.

Class: Aws::Synthetics::Client

Inherits:
Seahorse::Client::Base show all
Defined in:
(unknown)

Overview

An API client for Synthetics. To construct a client, you need to configure a :region and :credentials.

synthetics = Aws::Synthetics::Client.new(
  region: region_name,
  credentials: credentials,
  # ...
)

See #initialize for a full list of supported configuration options.

Region

You can configure a default region in the following locations:

  • ENV['AWS_REGION']
  • Aws.config[:region]

Go here for a list of supported regions.

Credentials

Default credentials are loaded automatically from the following locations:

  • ENV['AWS_ACCESS_KEY_ID'] and ENV['AWS_SECRET_ACCESS_KEY']
  • Aws.config[:credentials]
  • The shared credentials ini file at ~/.aws/credentials (more information)
  • From an instance profile when running on EC2

You can also construct a credentials object from one of the following classes:

Alternatively, you configure credentials with :access_key_id and :secret_access_key:

# load credentials from disk
creds = YAML.load(File.read('/path/to/secrets'))

Aws::Synthetics::Client.new(
  access_key_id: creds['access_key_id'],
  secret_access_key: creds['secret_access_key']
)

Always load your credentials from outside your application. Avoid configuring credentials statically and never commit them to source control.

Instance Attribute Summary

Attributes inherited from Seahorse::Client::Base

#config, #handlers

Constructor collapse

API Operations collapse

Instance Method Summary collapse

Methods inherited from Seahorse::Client::Base

add_plugin, api, #build_request, clear_plugins, define, new, #operation, #operation_names, plugins, remove_plugin, set_api, set_plugins

Methods included from Seahorse::Client::HandlerBuilder

#handle, #handle_request, #handle_response

Constructor Details

#initialize(options = {}) ⇒ Aws::Synthetics::Client

Constructs an API client.

Options Hash (options):

  • :access_key_id (String)

    Used to set credentials statically. See Plugins::RequestSigner for more details.

  • :active_endpoint_cache (Boolean)

    When set to true, a thread polling for endpoints will be running in the background every 60 secs (default). Defaults to false. See Plugins::EndpointDiscovery for more details.

  • :convert_params (Boolean) — default: true

    When true, an attempt is made to coerce request parameters into the required types. See Plugins::ParamConverter for more details.

  • :credentials (required, Credentials)

    Your AWS credentials. The following locations will be searched in order for credentials:

    • :access_key_id, :secret_access_key, and :session_token options
    • ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']
    • HOME/.aws/credentials shared credentials file
    • EC2 instance profile credentials See Plugins::RequestSigner for more details.
  • :disable_host_prefix_injection (Boolean)

    Set to true to disable SDK automatically adding host prefix to default service endpoint when available. See Plugins::EndpointPattern for more details.

  • :endpoint (String)

    A default endpoint is constructed from the :region. See Plugins::RegionalEndpoint for more details.

  • :endpoint_cache_max_entries (Integer)

    Used for the maximum size limit of the LRU cache storing endpoints data for endpoint discovery enabled operations. Defaults to 1000. See Plugins::EndpointDiscovery for more details.

  • :endpoint_cache_max_threads (Integer)

    Used for the maximum threads in use for polling endpoints to be cached, defaults to 10. See Plugins::EndpointDiscovery for more details.

  • :endpoint_cache_poll_interval (Integer)

    When :endpoint_discovery and :active_endpoint_cache is enabled, Use this option to config the time interval in seconds for making requests fetching endpoints information. Defaults to 60 sec. See Plugins::EndpointDiscovery for more details.

  • :endpoint_discovery (Boolean)

    When set to true, endpoint discovery will be enabled for operations when available. Defaults to false. See Plugins::EndpointDiscovery for more details.

  • :http_continue_timeout (Float) — default: 1

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_idle_timeout (Integer) — default: 5

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_open_timeout (Integer) — default: 15

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_proxy (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_read_timeout (Integer) — default: 60

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_wire_trace (Boolean) — default: false

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :log_level (Symbol) — default: :info

    The log level to send messages to the logger at. See Plugins::Logging for more details.

  • :log_formatter (Logging::LogFormatter)

    The log formatter. Defaults to Seahorse::Client::Logging::Formatter.default. See Plugins::Logging for more details.

  • :logger (Logger) — default: nil

    The Logger instance to send log messages to. If this option is not set, logging will be disabled. See Plugins::Logging for more details.

  • :profile (String)

    Used when loading credentials from the shared credentials file at HOME/.aws/credentials. When not specified, 'default' is used. See Plugins::RequestSigner for more details.

  • :raise_response_errors (Boolean) — default: true

    When true, response errors are raised. See Seahorse::Client::Plugins::RaiseResponseErrors for more details.

  • :region (required, String)

    The AWS region to connect to. The region is used to construct the client endpoint. Defaults to ENV['AWS_REGION']. Also checks AMAZON_REGION and AWS_DEFAULT_REGION. See Plugins::RegionalEndpoint for more details.

  • :retry_limit (Integer) — default: 3

    The maximum number of times to retry failed requests. Only ~ 500 level server errors and certain ~ 400 level client errors are retried. Generally, these are throttling errors, data checksum errors, networking errors, timeout errors and auth errors from expired credentials. See Plugins::RetryErrors for more details.

  • :secret_access_key (String)

    Used to set credentials statically. See Plugins::RequestSigner for more details.

  • :session_token (String)

    Used to set credentials statically. See Plugins::RequestSigner for more details.

  • :ssl_ca_bundle (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :ssl_ca_directory (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :ssl_ca_store (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :ssl_verify_peer (Boolean) — default: true

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :stub_responses (Boolean) — default: false

    Causes the client to return stubbed responses. By default fake responses are generated and returned. You can specify the response data to return or errors to raise by calling ClientStubs#stub_responses. See ClientStubs for more information.

    Please note When response stubbing is enabled, no HTTP requests are made, and retries are disabled. See Plugins::StubResponses for more details.

  • :validate_params (Boolean) — default: true

    When true, request parameters are validated before sending the request. See Plugins::ParamValidator for more details.

Instance Method Details

#create_canary(options = {}) ⇒ Types::CreateCanaryResponse

Creates a canary. Canaries are scripts that monitor your endpoints and APIs from the outside-in. Canaries help you check the availability and latency of your web services and troubleshoot anomalies by investigating load time data, screenshots of the UI, logs, and metrics. You can set up a canary to run continuously or just once.

Do not use CreateCanary to modify an existing canary. Use UpdateCanary instead.

To create canaries, you must have the CloudWatchSyntheticsFullAccess policy. If you are creating a new IAM role for the canary, you also need the the iam:CreateRole, iam:CreatePolicy and iam:AttachRolePolicy permissions. For more information, see Necessary Roles and Permissions.

Do not include secrets or proprietary information in your canary names. The canary name makes up part of the Amazon Resource Name (ARN) for the canary, and the ARN is included in outbound calls over the internet. For more information, see Security Considerations for Synthetics Canaries.

Examples:

Request syntax with placeholder values


resp = client.create_canary({
  name: "CanaryName", # required
  code: { # required
    s3_bucket: "String",
    s3_key: "String",
    s3_version: "String",
    zip_file: "data",
    handler: "String", # required
  },
  artifact_s3_location: "String", # required
  execution_role_arn: "RoleArn", # required
  schedule: { # required
    expression: "String", # required
    duration_in_seconds: 1,
  },
  run_config: {
    timeout_in_seconds: 1,
    memory_in_mb: 1,
    active_tracing: false,
    environment_variables: {
      "EnvironmentVariableName" => "EnvironmentVariableValue",
    },
  },
  success_retention_period_in_days: 1,
  failure_retention_period_in_days: 1,
  runtime_version: "String", # required
  vpc_config: {
    subnet_ids: ["SubnetId"],
    security_group_ids: ["SecurityGroupId"],
  },
  tags: {
    "TagKey" => "TagValue",
  },
})

Response structure


resp.canary.id #=> String
resp.canary.name #=> String
resp.canary.code.source_location_arn #=> String
resp.canary.code.handler #=> String
resp.canary.execution_role_arn #=> String
resp.canary.schedule.expression #=> String
resp.canary.schedule.duration_in_seconds #=> Integer
resp.canary.run_config.timeout_in_seconds #=> Integer
resp.canary.run_config.memory_in_mb #=> Integer
resp.canary.run_config.active_tracing #=> true/false
resp.canary.success_retention_period_in_days #=> Integer
resp.canary.failure_retention_period_in_days #=> Integer
resp.canary.status.state #=> String, one of "CREATING", "READY", "STARTING", "RUNNING", "UPDATING", "STOPPING", "STOPPED", "ERROR", "DELETING"
resp.canary.status.state_reason #=> String
resp.canary.status.state_reason_code #=> String, one of "INVALID_PERMISSIONS"
resp.canary.timeline.created #=> Time
resp.canary.timeline.last_modified #=> Time
resp.canary.timeline.last_started #=> Time
resp.canary.timeline.last_stopped #=> Time
resp.canary.artifact_s3_location #=> String
resp.canary.engine_arn #=> String
resp.canary.runtime_version #=> String
resp.canary.vpc_config.vpc_id #=> String
resp.canary.vpc_config.subnet_ids #=> Array
resp.canary.vpc_config.subnet_ids[0] #=> String
resp.canary.vpc_config.security_group_ids #=> Array
resp.canary.vpc_config.security_group_ids[0] #=> String
resp.canary.tags #=> Hash
resp.canary.tags["TagKey"] #=> String

Options Hash (options):

  • :name (required, String)

    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.

  • :code (required, Types::CanaryCodeInput)

    A structure that includes the entry point from which the canary should start running your script. If the script is stored in an S3 bucket, the bucket name, key, and version are also included.

  • :artifact_s3_location (required, String)

    The location in Amazon S3 where Synthetics stores artifacts from the test runs of this canary. Artifacts include the log file, screenshots, and HAR files.

  • :execution_role_arn (required, String)

    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

  • :schedule (required, Types::CanaryScheduleInput)

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

  • :run_config (Types::CanaryRunConfigInput)

    A structure that contains the configuration for individual canary runs, such as timeout value.

  • :success_retention_period_in_days (Integer)

    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.

  • :failure_retention_period_in_days (Integer)

    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.

  • :runtime_version (required, String)

    Specifies the runtime version to use for the canary. For a list of valid runtime versions and more information about runtime versions, see Canary Runtime Versions.

  • :vpc_config (Types::VpcConfigInput)

    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.

  • :tags (Hash<String,String>)

    A list of key-value pairs to associate with the canary. You can associate as many as 50 tags with a canary.

    Tags can help you organize and categorize your resources. You can also use them to scope user permissions, by granting a user permission to access or change only the resources that have certain tag values.

Returns:

See Also:

#delete_canary(options = {}) ⇒ Struct

Permanently deletes the specified canary.

When you delete a canary, resources used and created by the canary are not automatically deleted. After you delete a canary that you do not intend to use again, you should also delete the following:

  • The Lambda functions and layers used by this canary. These have the prefix cwsyn-MyCanaryName .

  • The CloudWatch alarms created for this canary. These alarms have a name of Synthetics-SharpDrop-Alarm-MyCanaryName .

  • Amazon S3 objects and buckets, such as the canary's artifact location.

  • IAM roles created for the canary. If they were created in the console, these roles have the name role/service-role/CloudWatchSyntheticsRole-MyCanaryName .

  • CloudWatch Logs log groups created for the canary. These logs groups have the name /aws/lambda/cwsyn-MyCanaryName .

Before you delete a canary, you might want to use GetCanary to display the information about this canary. Make note of the information returned by this operation so that you can delete these resources after you delete the canary.

Examples:

Request syntax with placeholder values


resp = client.delete_canary({
  name: "CanaryName", # required
})

Options Hash (options):

  • :name (required, String)

    The name of the canary that you want to delete. To find the names of your canaries, use DescribeCanaries.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#describe_canaries(options = {}) ⇒ Types::DescribeCanariesResponse

This operation returns a list of the canaries in your account, along with full details about each canary.

This operation does not have resource-level authorization, so if a user is able to use DescribeCanaries, the user can see all of the canaries in the account. A deny policy can only be used to restrict access to all canaries. It cannot be used on specific resources.

Examples:

Request syntax with placeholder values


resp = client.describe_canaries({
  next_token: "Token",
  max_results: 1,
})

Response structure


resp.canaries #=> Array
resp.canaries[0].id #=> String
resp.canaries[0].name #=> String
resp.canaries[0].code.source_location_arn #=> String
resp.canaries[0].code.handler #=> String
resp.canaries[0].execution_role_arn #=> String
resp.canaries[0].schedule.expression #=> String
resp.canaries[0].schedule.duration_in_seconds #=> Integer
resp.canaries[0].run_config.timeout_in_seconds #=> Integer
resp.canaries[0].run_config.memory_in_mb #=> Integer
resp.canaries[0].run_config.active_tracing #=> true/false
resp.canaries[0].success_retention_period_in_days #=> Integer
resp.canaries[0].failure_retention_period_in_days #=> Integer
resp.canaries[0].status.state #=> String, one of "CREATING", "READY", "STARTING", "RUNNING", "UPDATING", "STOPPING", "STOPPED", "ERROR", "DELETING"
resp.canaries[0].status.state_reason #=> String
resp.canaries[0].status.state_reason_code #=> String, one of "INVALID_PERMISSIONS"
resp.canaries[0].timeline.created #=> Time
resp.canaries[0].timeline.last_modified #=> Time
resp.canaries[0].timeline.last_started #=> Time
resp.canaries[0].timeline.last_stopped #=> Time
resp.canaries[0].artifact_s3_location #=> String
resp.canaries[0].engine_arn #=> String
resp.canaries[0].runtime_version #=> String
resp.canaries[0].vpc_config.vpc_id #=> String
resp.canaries[0].vpc_config.subnet_ids #=> Array
resp.canaries[0].vpc_config.subnet_ids[0] #=> String
resp.canaries[0].vpc_config.security_group_ids #=> Array
resp.canaries[0].vpc_config.security_group_ids[0] #=> String
resp.canaries[0].tags #=> Hash
resp.canaries[0].tags["TagKey"] #=> String
resp.next_token #=> String

Options Hash (options):

  • :next_token (String)

    A token that indicates that there is more data available. You can use this token in a subsequent operation to retrieve the next set of results.

  • :max_results (Integer)

    Specify this parameter to limit how many canaries are returned each time you use the DescribeCanaries operation. If you omit this parameter, the default of 100 is used.

Returns:

See Also:

#describe_canaries_last_run(options = {}) ⇒ Types::DescribeCanariesLastRunResponse

Use this operation to see information from the most recent run of each canary that you have created.

Examples:

Request syntax with placeholder values


resp = client.describe_canaries_last_run({
  next_token: "Token",
  max_results: 1,
})

Response structure


resp.canaries_last_run #=> Array
resp.canaries_last_run[0].canary_name #=> String
resp.canaries_last_run[0].last_run.id #=> String
resp.canaries_last_run[0].last_run.name #=> String
resp.canaries_last_run[0].last_run.status.state #=> String, one of "RUNNING", "PASSED", "FAILED"
resp.canaries_last_run[0].last_run.status.state_reason #=> String
resp.canaries_last_run[0].last_run.status.state_reason_code #=> String, one of "CANARY_FAILURE", "EXECUTION_FAILURE"
resp.canaries_last_run[0].last_run.timeline.started #=> Time
resp.canaries_last_run[0].last_run.timeline.completed #=> Time
resp.canaries_last_run[0].last_run.artifact_s3_location #=> String
resp.next_token #=> String

Options Hash (options):

  • :next_token (String)

    A token that indicates that there is more data available. You can use this token in a subsequent DescribeCanaries operation to retrieve the next set of results.

  • :max_results (Integer)

    Specify this parameter to limit how many runs are returned each time you use the DescribeLastRun operation. If you omit this parameter, the default of 100 is used.

Returns:

See Also:

#describe_runtime_versions(options = {}) ⇒ Types::DescribeRuntimeVersionsResponse

Returns a list of Synthetics canary runtime versions. For more information, see Canary Runtime Versions.

Examples:

Request syntax with placeholder values


resp = client.describe_runtime_versions({
  next_token: "Token",
  max_results: 1,
})

Response structure


resp.runtime_versions #=> Array
resp.runtime_versions[0].version_name #=> String
resp.runtime_versions[0].description #=> String
resp.runtime_versions[0].release_date #=> Time
resp.runtime_versions[0].deprecation_date #=> Time
resp.next_token #=> String

Options Hash (options):

  • :next_token (String)

    A token that indicates that there is more data available. You can use this token in a subsequent DescribeRuntimeVersions operation to retrieve the next set of results.

  • :max_results (Integer)

    Specify this parameter to limit how many runs are returned each time you use the DescribeRuntimeVersions operation. If you omit this parameter, the default of 100 is used.

Returns:

See Also:

#get_canary(options = {}) ⇒ Types::GetCanaryResponse

Retrieves complete information about one canary. You must specify the name of the canary that you want. To get a list of canaries and their names, use DescribeCanaries.

Examples:

Request syntax with placeholder values


resp = client.get_canary({
  name: "CanaryName", # required
})

Response structure


resp.canary.id #=> String
resp.canary.name #=> String
resp.canary.code.source_location_arn #=> String
resp.canary.code.handler #=> String
resp.canary.execution_role_arn #=> String
resp.canary.schedule.expression #=> String
resp.canary.schedule.duration_in_seconds #=> Integer
resp.canary.run_config.timeout_in_seconds #=> Integer
resp.canary.run_config.memory_in_mb #=> Integer
resp.canary.run_config.active_tracing #=> true/false
resp.canary.success_retention_period_in_days #=> Integer
resp.canary.failure_retention_period_in_days #=> Integer
resp.canary.status.state #=> String, one of "CREATING", "READY", "STARTING", "RUNNING", "UPDATING", "STOPPING", "STOPPED", "ERROR", "DELETING"
resp.canary.status.state_reason #=> String
resp.canary.status.state_reason_code #=> String, one of "INVALID_PERMISSIONS"
resp.canary.timeline.created #=> Time
resp.canary.timeline.last_modified #=> Time
resp.canary.timeline.last_started #=> Time
resp.canary.timeline.last_stopped #=> Time
resp.canary.artifact_s3_location #=> String
resp.canary.engine_arn #=> String
resp.canary.runtime_version #=> String
resp.canary.vpc_config.vpc_id #=> String
resp.canary.vpc_config.subnet_ids #=> Array
resp.canary.vpc_config.subnet_ids[0] #=> String
resp.canary.vpc_config.security_group_ids #=> Array
resp.canary.vpc_config.security_group_ids[0] #=> String
resp.canary.tags #=> Hash
resp.canary.tags["TagKey"] #=> String

Options Hash (options):

  • :name (required, String)

    The name of the canary that you want details for.

Returns:

See Also:

#get_canary_runs(options = {}) ⇒ Types::GetCanaryRunsResponse

Retrieves a list of runs for a specified canary.

Examples:

Request syntax with placeholder values


resp = client.get_canary_runs({
  name: "CanaryName", # required
  next_token: "Token",
  max_results: 1,
})

Response structure


resp.canary_runs #=> Array
resp.canary_runs[0].id #=> String
resp.canary_runs[0].name #=> String
resp.canary_runs[0].status.state #=> String, one of "RUNNING", "PASSED", "FAILED"
resp.canary_runs[0].status.state_reason #=> String
resp.canary_runs[0].status.state_reason_code #=> String, one of "CANARY_FAILURE", "EXECUTION_FAILURE"
resp.canary_runs[0].timeline.started #=> Time
resp.canary_runs[0].timeline.completed #=> Time
resp.canary_runs[0].artifact_s3_location #=> String
resp.next_token #=> String

Options Hash (options):

  • :name (required, String)

    The name of the canary that you want to see runs for.

  • :next_token (String)

    A token that indicates that there is more data available. You can use this token in a subsequent GetCanaryRuns operation to retrieve the next set of results.

  • :max_results (Integer)

    Specify this parameter to limit how many runs are returned each time you use the GetCanaryRuns operation. If you omit this parameter, the default of 100 is used.

Returns:

See Also:

#list_tags_for_resource(options = {}) ⇒ Types::ListTagsForResourceResponse

Displays the tags associated with a canary.

Examples:

Request syntax with placeholder values


resp = client.list_tags_for_resource({
  resource_arn: "CanaryArn", # required
})

Response structure


resp.tags #=> Hash
resp.tags["TagKey"] #=> String

Options Hash (options):

  • :resource_arn (required, String)

    The ARN of the canary that you want to view tags for.

    The ARN format of a canary is arn:aws:synthetics:Region:account-id:canary:canary-name.

Returns:

See Also:

#start_canary(options = {}) ⇒ Struct

Use this operation to run a canary that has already been created. The frequency of the canary runs is determined by the value of the canary's Schedule. To see a canary's schedule, use GetCanary.

Examples:

Request syntax with placeholder values


resp = client.start_canary({
  name: "CanaryName", # required
})

Options Hash (options):

  • :name (required, String)

    The name of the canary that you want to run. To find canary names, use DescribeCanaries.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#stop_canary(options = {}) ⇒ Struct

Stops the canary to prevent all future runs. If the canary is currently running, Synthetics stops waiting for the current run of the specified canary to complete. The run that is in progress completes on its own, publishes metrics, and uploads artifacts, but it is not recorded in Synthetics as a completed run.

You can use StartCanary to start it running again with the canary’s current schedule at any point in the future.

Examples:

Request syntax with placeholder values


resp = client.stop_canary({
  name: "CanaryName", # required
})

Options Hash (options):

  • :name (required, String)

    The name of the canary that you want to stop. To find the names of your canaries, use DescribeCanaries.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#tag_resource(options = {}) ⇒ Struct

Assigns one or more tags (key-value pairs) to the specified canary.

Tags can help you organize and categorize your resources. You can also use them to scope user permissions, by granting a user permission to access or change only resources with certain tag values.

Tags don't have any semantic meaning to AWS and are interpreted strictly as strings of characters.

You can use the TagResource action with a canary that already has tags. If you specify a new tag key for the alarm, this tag is appended to the list of tags associated with the alarm. If you specify a tag key that is already associated with the alarm, the new tag value that you specify replaces the previous value for that tag.

You can associate as many as 50 tags with a canary.

Examples:

Request syntax with placeholder values


resp = client.tag_resource({
  resource_arn: "CanaryArn", # required
  tags: { # required
    "TagKey" => "TagValue",
  },
})

Options Hash (options):

  • :resource_arn (required, String)

    The ARN of the canary that you\'re adding tags to.

    The ARN format of a canary is arn:aws:synthetics:Region:account-id:canary:canary-name.

  • :tags (required, Hash<String,String>)

    The list of key-value pairs to associate with the canary.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#untag_resource(options = {}) ⇒ Struct

Removes one or more tags from the specified canary.

Examples:

Request syntax with placeholder values


resp = client.untag_resource({
  resource_arn: "CanaryArn", # required
  tag_keys: ["TagKey"], # required
})

Options Hash (options):

  • :resource_arn (required, String)

    The ARN of the canary that you\'re removing tags from.

    The ARN format of a canary is arn:aws:synthetics:Region:account-id:canary:canary-name.

  • :tag_keys (required, Array<String>)

    The list of tag keys to remove from the resource.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#update_canary(options = {}) ⇒ Struct

Use this operation to change the settings of a canary that has already been created.

You can't use this operation to update the tags of an existing canary. To change the tags of an existing canary, use TagResource.

Examples:

Request syntax with placeholder values


resp = client.update_canary({
  name: "CanaryName", # required
  code: {
    s3_bucket: "String",
    s3_key: "String",
    s3_version: "String",
    zip_file: "data",
    handler: "String", # required
  },
  execution_role_arn: "RoleArn",
  runtime_version: "String",
  schedule: {
    expression: "String", # required
    duration_in_seconds: 1,
  },
  run_config: {
    timeout_in_seconds: 1,
    memory_in_mb: 1,
    active_tracing: false,
    environment_variables: {
      "EnvironmentVariableName" => "EnvironmentVariableValue",
    },
  },
  success_retention_period_in_days: 1,
  failure_retention_period_in_days: 1,
  vpc_config: {
    subnet_ids: ["SubnetId"],
    security_group_ids: ["SecurityGroupId"],
  },
})

Options Hash (options):

  • :name (required, String)

    The name of the canary that you want to update. To find the names of your canaries, use DescribeCanaries.

    You cannot change the name of a canary that has already been created.

  • :code (Types::CanaryCodeInput)

    A structure that includes the entry point from which the canary should start running your script. If the script is stored in an S3 bucket, the bucket name, key, and version are also included.

  • :execution_role_arn (String)

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

  • :runtime_version (String)

    Specifies the runtime version to use for the canary. For a list of valid runtime versions and for more information about runtime versions, see Canary Runtime Versions.

  • :schedule (Types::CanaryScheduleInput)

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

  • :run_config (Types::CanaryRunConfigInput)

    A structure that contains the timeout value that is used for each individual run of the canary.

  • :success_retention_period_in_days (Integer)

    The number of days to retain data about successful runs of this canary.

  • :failure_retention_period_in_days (Integer)

    The number of days to retain data about failed runs of this canary.

  • :vpc_config (Types::VpcConfigInput)

    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.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#wait_until(waiter_name, params = {}) {|waiter| ... } ⇒ Boolean

Waiters polls an API operation until a resource enters a desired state.

Basic Usage

Waiters will poll until they are succesful, they fail by entering a terminal state, or until a maximum number of attempts are made.

# polls in a loop, sleeping between attempts client.waiter_until(waiter_name, params)

Configuration

You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. You configure waiters by passing a block to #wait_until:

# poll for ~25 seconds
client.wait_until(...) do |w|
  w.max_attempts = 5
  w.delay = 5
end

Callbacks

You can be notified before each polling attempt and before each delay. If you throw :success or :failure from these callbacks, it will terminate the waiter.

started_at = Time.now
client.wait_until(...) do |w|

  # disable max attempts
  w.max_attempts = nil

  # poll for 1 hour, instead of a number of attempts
  w.before_wait do |attempts, response|
    throw :failure if Time.now - started_at > 3600
  end

end

Handling Errors

When a waiter is successful, it returns true. When a waiter fails, it raises an error. All errors raised extend from Waiters::Errors::WaiterFailed.

begin
  client.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
  # resource did not enter the desired state in time
end

Parameters:

  • waiter_name (Symbol)

    The name of the waiter. See #waiter_names for a full list of supported waiters.

  • params (Hash) (defaults to: {})

    Additional request parameters. See the #waiter_names for a list of supported waiters and what request they call. The called request determines the list of accepted parameters.

Yield Parameters:

Returns:

  • (Boolean)

    Returns true if the waiter was successful.

Raises:

  • (Errors::FailureStateError)

    Raised when the waiter terminates because the waiter has entered a state that it will not transition out of, preventing success.

  • (Errors::TooManyAttemptsError)

    Raised when the configured maximum number of attempts have been made, and the waiter is not yet successful.

  • (Errors::UnexpectedError)

    Raised when an error is encounted while polling for a resource that is not expected.

  • (Errors::NoSuchWaiterError)

    Raised when you request to wait for an unknown state.

#waiter_namesArray<Symbol>

Returns the list of supported waiters. The following table lists the supported waiters and the client method they call:

Waiter NameClient MethodDefault Delay:Default Max Attempts:

Returns:

  • (Array<Symbol>)

    the list of supported waiters.