pub struct Client { /* private fields */ }Expand description
Client for Synthetics
Client for invoking operations on Synthetics. Each operation on Synthetics is a method on this
this struct. .send() MUST be invoked on the generated operations to dispatch the request to the service.
§Constructing a Client
A Config is required to construct a client. For most use cases, the aws-config
crate should be used to automatically resolve this config using
aws_config::load_from_env(), since this will resolve an SdkConfig which can be shared
across multiple different AWS SDK clients. This config resolution process can be customized
by calling aws_config::from_env() instead, which returns a ConfigLoader that uses
the builder pattern to customize the default config.
In the simplest case, creating a client looks as follows:
let config = aws_config::load_from_env().await;
let client = aws_sdk_synthetics::Client::new(&config);Occasionally, SDKs may have additional service-specific values that can be set on the Config that
is absent from SdkConfig, or slightly different settings for a specific client may be desired.
The Builder struct implements From<&SdkConfig>, so setting these specific settings can be
done as follows:
let sdk_config = ::aws_config::load_from_env().await;
let config = aws_sdk_synthetics::config::Builder::from(&sdk_config)
.some_service_specific_setting("value")
.build();See the aws-config docs and Config for more information on customizing configuration.
Note: Client construction is expensive due to connection thread pool initialization, and should be done once at application start-up.
§Using the Client
A client has a function for every operation that can be performed by the service.
For example, the AssociateResource operation has
a Client::associate_resource, function which returns a builder for that operation.
The fluent builder ultimately has a send() function that returns an async future that
returns a result, as illustrated below:
let result = client.associate_resource()
.group_identifier("example")
.send()
.await;The underlying HTTP requests that get made by this can be modified with the customize_operation
function on the fluent builder. See the customize module for more
information.
Implementations§
Source§impl Client
impl Client
Sourcepub fn associate_resource(&self) -> AssociateResourceFluentBuilder
pub fn associate_resource(&self) -> AssociateResourceFluentBuilder
Constructs a fluent builder for the AssociateResource operation.
- The fluent builder is configurable:
group_identifier(impl Into<String>)/set_group_identifier(Option<String>):
required: trueSpecifies the group. You can specify the group name, the ARN, or the group ID as the
GroupIdentifier.resource_arn(impl Into<String>)/set_resource_arn(Option<String>):
required: trueThe ARN of the canary that you want to associate with the specified group.
- On success, responds with
AssociateResourceOutput - On failure, responds with
SdkError<AssociateResourceError>
Source§impl Client
impl Client
Sourcepub fn create_canary(&self) -> CreateCanaryFluentBuilder
pub fn create_canary(&self) -> CreateCanaryFluentBuilder
Constructs a fluent builder for the CreateCanary operation.
- The fluent builder is configurable:
name(impl Into<String>)/set_name(Option<String>):
required: trueThe 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(CanaryCodeInput)/set_code(Option<CanaryCodeInput>):
required: trueA structure that includes the entry point from which the canary should start running your script. If the script is stored in an Amazon S3 bucket, the bucket name, key, and version are also included.
artifact_s3_location(impl Into<String>)/set_artifact_s3_location(Option<String>):
required: trueThe location in Amazon S3 where Synthetics stores artifacts from the test runs of this canary. Artifacts include the log file, screenshots, and HAR files. The name of the Amazon S3 bucket can’t include a period (.).
execution_role_arn(impl Into<String>)/set_execution_role_arn(Option<String>):
required: trueThe ARN of the IAM role to be used to run the canary. This role must already exist, and must include
lambda.amazonaws.comas 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(CanaryScheduleInput)/set_schedule(Option<CanaryScheduleInput>):
required: trueA structure that contains information about how often the canary is to run and when these test runs are to stop.
run_config(CanaryRunConfigInput)/set_run_config(Option<CanaryRunConfigInput>):
required: falseA structure that contains the configuration for individual canary runs, such as timeout value and environment variables.
Environment variable keys and values are encrypted at rest using Amazon Web Services owned KMS keys. However, the environment variables are not encrypted on the client side. Do not store sensitive information in them.
success_retention_period_in_days(i32)/set_success_retention_period_in_days(Option<i32>):
required: falseThe 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.
failure_retention_period_in_days(i32)/set_failure_retention_period_in_days(Option<i32>):
required: falseThe 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.
runtime_version(impl Into<String>)/set_runtime_version(Option<String>):
required: trueSpecifies 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(VpcConfigInput)/set_vpc_config(Option<VpcConfigInput>):
required: falseIf 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.
resources_to_replicate_tags(ResourceToTag)/set_resources_to_replicate_tags(Option<Vec::<ResourceToTag>>):
required: falseTo have the tags that you apply to this canary also be applied to the Lambda function that the canary uses, specify this parameter with the value
lambda-function.If you specify this parameter and don’t specify any tags in the
Tagsparameter, the canary creation fails.provisioned_resource_cleanup(ProvisionedResourceCleanupSetting)/set_provisioned_resource_cleanup(Option<ProvisionedResourceCleanupSetting>):
required: falseSpecifies whether to also delete the Lambda functions and layers used by this canary when the canary is deleted. If you omit this parameter, the default of
AUTOMATICis used, which means that 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 theDeleteLambdaparameter of the DeleteCanary operation determines whether the Lambda functions and layers will be deleted.browser_configs(BrowserConfig)/set_browser_configs(Option<Vec::<BrowserConfig>>):
required: falseCloudWatch Synthetics now supports multibrowser canaries for
syn-nodejs-puppeteer-11.0andsyn-nodejs-playwright-3.0runtimes. This feature allows you to run your canaries on both Firefox and Chrome browsers. To create a multibrowser canary, you need to specify the BrowserConfigs with a list of browsers you want to use.If not specified,
browserConfigsdefaults to Chrome.tags(impl Into<String>, impl Into<String>)/set_tags(Option<HashMap::<String, String>>):
required: falseA 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.
To have the tags that you apply to this canary also be applied to the Lambda function that the canary uses, specify this parameter with the value
lambda-function.artifact_config(ArtifactConfigInput)/set_artifact_config(Option<ArtifactConfigInput>):
required: falseA structure that contains the configuration for canary artifacts, including the encryption-at-rest settings for artifacts that the canary uploads to Amazon S3.
- On success, responds with
CreateCanaryOutputwith field(s):canary(Option<Canary>):The full details about the canary you have created.
- On failure, responds with
SdkError<CreateCanaryError>
Source§impl Client
impl Client
Sourcepub fn create_group(&self) -> CreateGroupFluentBuilder
pub fn create_group(&self) -> CreateGroupFluentBuilder
Constructs a fluent builder for the CreateGroup operation.
- The fluent builder is configurable:
name(impl Into<String>)/set_name(Option<String>):
required: trueThe name for the group. It can include any Unicode characters.
The names for all groups in your account, across all Regions, must be unique.
tags(impl Into<String>, impl Into<String>)/set_tags(Option<HashMap::<String, String>>):
required: falseA list of key-value pairs to associate with the group. You can associate as many as 50 tags with a group.
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.
- On success, responds with
CreateGroupOutputwith field(s):group(Option<Group>):A structure that contains information about the group that was just created.
- On failure, responds with
SdkError<CreateGroupError>
Source§impl Client
impl Client
Sourcepub fn delete_canary(&self) -> DeleteCanaryFluentBuilder
pub fn delete_canary(&self) -> DeleteCanaryFluentBuilder
Constructs a fluent builder for the DeleteCanary operation.
- The fluent builder is configurable:
name(impl Into<String>)/set_name(Option<String>):
required: trueThe name of the canary that you want to delete. To find the names of your canaries, use DescribeCanaries.
delete_lambda(bool)/set_delete_lambda(Option<bool>):
required: falseSpecifies whether to also delete the Lambda functions and layers used by this canary. The default is
false.Your setting for this parameter is used only if the canary doesn’t have
AUTOMATICfor itsProvisionedResourceCleanupfield. If that field is set toAUTOMATIC, then the Lambda functions and layers will be deleted when this canary is deleted.Type: Boolean
- On success, responds with
DeleteCanaryOutput - On failure, responds with
SdkError<DeleteCanaryError>
Source§impl Client
impl Client
Sourcepub fn delete_group(&self) -> DeleteGroupFluentBuilder
pub fn delete_group(&self) -> DeleteGroupFluentBuilder
Constructs a fluent builder for the DeleteGroup operation.
- The fluent builder is configurable:
group_identifier(impl Into<String>)/set_group_identifier(Option<String>):
required: trueSpecifies which group to delete. You can specify the group name, the ARN, or the group ID as the
GroupIdentifier.
- On success, responds with
DeleteGroupOutput - On failure, responds with
SdkError<DeleteGroupError>
Source§impl Client
impl Client
Sourcepub fn describe_canaries(&self) -> DescribeCanariesFluentBuilder
pub fn describe_canaries(&self) -> DescribeCanariesFluentBuilder
Constructs a fluent builder for the DescribeCanaries operation.
This operation supports pagination; See into_paginator().
- The fluent builder is configurable:
next_token(impl Into<String>)/set_next_token(Option<String>):
required: falseA 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(i32)/set_max_results(Option<i32>):
required: falseSpecify this parameter to limit how many canaries are returned each time you use the
DescribeCanariesoperation. If you omit this parameter, the default of 20 is used.names(impl Into<String>)/set_names(Option<Vec::<String>>):
required: falseUse this parameter to return only canaries that match the names that you specify here. You can specify as many as five canary names.
If you specify this parameter, the operation is successful only if you have authorization to view all the canaries that you specify in your request. If you do not have permission to view any of the canaries, the request fails with a 403 response.
You are required to use this parameter if you are logged on to a user or role that has an IAM policy that restricts which canaries that you are allowed to view. For more information, see Limiting a user to viewing specific canaries.
- On success, responds with
DescribeCanariesOutputwith field(s):canaries(Option<Vec::<Canary>>):Returns an array. Each item in the array contains the full information about one canary.
next_token(Option<String>):A token that indicates that there is more data available. You can use this token in a subsequent
DescribeCanariesoperation to retrieve the next set of results.
- On failure, responds with
SdkError<DescribeCanariesError>
Source§impl Client
impl Client
Sourcepub fn describe_canaries_last_run(&self) -> DescribeCanariesLastRunFluentBuilder
pub fn describe_canaries_last_run(&self) -> DescribeCanariesLastRunFluentBuilder
Constructs a fluent builder for the DescribeCanariesLastRun operation.
This operation supports pagination; See into_paginator().
- The fluent builder is configurable:
next_token(impl Into<String>)/set_next_token(Option<String>):
required: falseA token that indicates that there is more data available. You can use this token in a subsequent
DescribeCanariesLastRunoperation to retrieve the next set of results.max_results(i32)/set_max_results(Option<i32>):
required: falseSpecify this parameter to limit how many runs are returned each time you use the
DescribeLastRunoperation. If you omit this parameter, the default of 100 is used.names(impl Into<String>)/set_names(Option<Vec::<String>>):
required: falseUse this parameter to return only canaries that match the names that you specify here. You can specify as many as five canary names.
If you specify this parameter, the operation is successful only if you have authorization to view all the canaries that you specify in your request. If you do not have permission to view any of the canaries, the request fails with a 403 response.
You are required to use the
Namesparameter if you are logged on to a user or role that has an IAM policy that restricts which canaries that you are allowed to view. For more information, see Limiting a user to viewing specific canaries.browser_type(BrowserType)/set_browser_type(Option<BrowserType>):
required: falseThe type of browser to use for the canary run.
- On success, responds with
DescribeCanariesLastRunOutputwith field(s):canaries_last_run(Option<Vec::<CanaryLastRun>>):An array that contains the information from the most recent run of each canary.
next_token(Option<String>):A token that indicates that there is more data available. You can use this token in a subsequent
DescribeCanariesLastRunoperation to retrieve the next set of results.
- On failure, responds with
SdkError<DescribeCanariesLastRunError>
Source§impl Client
impl Client
Sourcepub fn describe_runtime_versions(&self) -> DescribeRuntimeVersionsFluentBuilder
pub fn describe_runtime_versions(&self) -> DescribeRuntimeVersionsFluentBuilder
Constructs a fluent builder for the DescribeRuntimeVersions operation.
This operation supports pagination; See into_paginator().
- The fluent builder is configurable:
next_token(impl Into<String>)/set_next_token(Option<String>):
required: falseA token that indicates that there is more data available. You can use this token in a subsequent
DescribeRuntimeVersionsoperation to retrieve the next set of results.max_results(i32)/set_max_results(Option<i32>):
required: falseSpecify this parameter to limit how many runs are returned each time you use the
DescribeRuntimeVersionsoperation. If you omit this parameter, the default of 100 is used.
- On success, responds with
DescribeRuntimeVersionsOutputwith field(s):runtime_versions(Option<Vec::<RuntimeVersion>>):An array of objects that display the details about each Synthetics canary runtime version.
next_token(Option<String>):A token that indicates that there is more data available. You can use this token in a subsequent
DescribeRuntimeVersionsoperation to retrieve the next set of results.
- On failure, responds with
SdkError<DescribeRuntimeVersionsError>
Source§impl Client
impl Client
Sourcepub fn disassociate_resource(&self) -> DisassociateResourceFluentBuilder
pub fn disassociate_resource(&self) -> DisassociateResourceFluentBuilder
Constructs a fluent builder for the DisassociateResource operation.
- The fluent builder is configurable:
group_identifier(impl Into<String>)/set_group_identifier(Option<String>):
required: trueSpecifies the group. You can specify the group name, the ARN, or the group ID as the
GroupIdentifier.resource_arn(impl Into<String>)/set_resource_arn(Option<String>):
required: trueThe ARN of the canary that you want to remove from the specified group.
- On success, responds with
DisassociateResourceOutput - On failure, responds with
SdkError<DisassociateResourceError>
Source§impl Client
impl Client
Sourcepub fn get_canary(&self) -> GetCanaryFluentBuilder
pub fn get_canary(&self) -> GetCanaryFluentBuilder
Constructs a fluent builder for the GetCanary operation.
- The fluent builder is configurable:
name(impl Into<String>)/set_name(Option<String>):
required: trueThe name of the canary that you want details for.
dry_run_id(impl Into<String>)/set_dry_run_id(Option<String>):
required: falseThe DryRunId associated with an existing canary’s dry run. You can use this DryRunId to retrieve information about the dry run.
- On success, responds with
GetCanaryOutputwith field(s):canary(Option<Canary>):A structure that contains the full information about the canary.
- On failure, responds with
SdkError<GetCanaryError>
Source§impl Client
impl Client
Sourcepub fn get_canary_runs(&self) -> GetCanaryRunsFluentBuilder
pub fn get_canary_runs(&self) -> GetCanaryRunsFluentBuilder
Constructs a fluent builder for the GetCanaryRuns operation.
This operation supports pagination; See into_paginator().
- The fluent builder is configurable:
name(impl Into<String>)/set_name(Option<String>):
required: trueThe name of the canary that you want to see runs for.
next_token(impl Into<String>)/set_next_token(Option<String>):
required: falseA token that indicates that there is more data available. You can use this token in a subsequent
GetCanaryRunsoperation to retrieve the next set of results.When auto retry is enabled for the canary, the first subsequent retry is suffixed with *1 indicating its the first retry and the next subsequent try is suffixed with *2.
max_results(i32)/set_max_results(Option<i32>):
required: falseSpecify this parameter to limit how many runs are returned each time you use the
GetCanaryRunsoperation. If you omit this parameter, the default of 100 is used.dry_run_id(impl Into<String>)/set_dry_run_id(Option<String>):
required: falseThe DryRunId associated with an existing canary’s dry run. You can use this DryRunId to retrieve information about the dry run.
run_type(RunType)/set_run_type(Option<RunType>):
required: false-
When you provide
RunType=CANARY_RUNanddryRunId, you will get an exception -
When a value is not provided for
RunType, the default value isCANARY_RUN -
When
CANARY_RUNis provided, all canary runs excluding dry runs are returned -
When
DRY_RUNis provided, all dry runs excluding canary runs are returned
-
- On success, responds with
GetCanaryRunsOutputwith field(s):canary_runs(Option<Vec::<CanaryRun>>):An array of structures. Each structure contains the details of one of the retrieved canary runs.
next_token(Option<String>):A token that indicates that there is more data available. You can use this token in a subsequent
GetCanaryRunsoperation to retrieve the next set of results.
- On failure, responds with
SdkError<GetCanaryRunsError>
Source§impl Client
impl Client
Sourcepub fn get_group(&self) -> GetGroupFluentBuilder
pub fn get_group(&self) -> GetGroupFluentBuilder
Constructs a fluent builder for the GetGroup operation.
- The fluent builder is configurable:
group_identifier(impl Into<String>)/set_group_identifier(Option<String>):
required: trueSpecifies the group to return information for. You can specify the group name, the ARN, or the group ID as the
GroupIdentifier.
- On success, responds with
GetGroupOutputwith field(s):group(Option<Group>):A structure that contains information about the group.
- On failure, responds with
SdkError<GetGroupError>
Source§impl Client
impl Client
Sourcepub fn list_associated_groups(&self) -> ListAssociatedGroupsFluentBuilder
pub fn list_associated_groups(&self) -> ListAssociatedGroupsFluentBuilder
Constructs a fluent builder for the ListAssociatedGroups operation.
This operation supports pagination; See into_paginator().
- The fluent builder is configurable:
next_token(impl Into<String>)/set_next_token(Option<String>):
required: falseA 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(i32)/set_max_results(Option<i32>):
required: falseSpecify this parameter to limit how many groups are returned each time you use the
ListAssociatedGroupsoperation. If you omit this parameter, the default of 20 is used.resource_arn(impl Into<String>)/set_resource_arn(Option<String>):
required: trueThe ARN of the canary that you want to view groups for.
- On success, responds with
ListAssociatedGroupsOutputwith field(s):groups(Option<Vec::<GroupSummary>>):An array of structures that contain information about the groups that this canary is associated with.
next_token(Option<String>):A token that indicates that there is more data available. You can use this token in a subsequent
ListAssociatedGroupsoperation to retrieve the next set of results.
- On failure, responds with
SdkError<ListAssociatedGroupsError>
Source§impl Client
impl Client
Sourcepub fn list_group_resources(&self) -> ListGroupResourcesFluentBuilder
pub fn list_group_resources(&self) -> ListGroupResourcesFluentBuilder
Constructs a fluent builder for the ListGroupResources operation.
This operation supports pagination; See into_paginator().
- The fluent builder is configurable:
next_token(impl Into<String>)/set_next_token(Option<String>):
required: falseA 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(i32)/set_max_results(Option<i32>):
required: falseSpecify this parameter to limit how many canary ARNs are returned each time you use the
ListGroupResourcesoperation. If you omit this parameter, the default of 20 is used.group_identifier(impl Into<String>)/set_group_identifier(Option<String>):
required: trueSpecifies the group to return information for. You can specify the group name, the ARN, or the group ID as the
GroupIdentifier.
- On success, responds with
ListGroupResourcesOutputwith field(s):resources(Option<Vec::<String>>):An array of ARNs. These ARNs are for the canaries that are associated with the group.
next_token(Option<String>):A token that indicates that there is more data available. You can use this token in a subsequent
ListGroupResourcesoperation to retrieve the next set of results.
- On failure, responds with
SdkError<ListGroupResourcesError>
Source§impl Client
impl Client
Sourcepub fn list_groups(&self) -> ListGroupsFluentBuilder
pub fn list_groups(&self) -> ListGroupsFluentBuilder
Constructs a fluent builder for the ListGroups operation.
This operation supports pagination; See into_paginator().
- The fluent builder is configurable:
next_token(impl Into<String>)/set_next_token(Option<String>):
required: falseA 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(i32)/set_max_results(Option<i32>):
required: falseSpecify this parameter to limit how many groups are returned each time you use the
ListGroupsoperation. If you omit this parameter, the default of 20 is used.
- On success, responds with
ListGroupsOutputwith field(s):groups(Option<Vec::<GroupSummary>>):An array of structures that each contain information about one group.
next_token(Option<String>):A token that indicates that there is more data available. You can use this token in a subsequent
ListGroupsoperation to retrieve the next set of results.
- On failure, responds with
SdkError<ListGroupsError>
Source§impl Client
impl Client
Constructs a fluent builder for the ListTagsForResource operation.
- The fluent builder is configurable:
resource_arn(impl Into<String>)/set_resource_arn(Option<String>):
required: trueThe ARN of the canary or group that you want to view tags for.
The ARN format of a canary is
arn:aws:synthetics:Region:account-id:canary:canary-name.The ARN format of a group is
arn:aws:synthetics:Region:account-id:group:group-name
- On success, responds with
ListTagsForResourceOutputwith field(s):tags(Option<HashMap::<String, String>>):The list of tag keys and values associated with the resource that you specified.
- On failure, responds with
SdkError<ListTagsForResourceError>
Source§impl Client
impl Client
Sourcepub fn start_canary(&self) -> StartCanaryFluentBuilder
pub fn start_canary(&self) -> StartCanaryFluentBuilder
Constructs a fluent builder for the StartCanary operation.
- The fluent builder is configurable:
name(impl Into<String>)/set_name(Option<String>):
required: trueThe name of the canary that you want to run. To find canary names, use DescribeCanaries.
- On success, responds with
StartCanaryOutput - On failure, responds with
SdkError<StartCanaryError>
Source§impl Client
impl Client
Sourcepub fn start_canary_dry_run(&self) -> StartCanaryDryRunFluentBuilder
pub fn start_canary_dry_run(&self) -> StartCanaryDryRunFluentBuilder
Constructs a fluent builder for the StartCanaryDryRun operation.
- The fluent builder is configurable:
name(impl Into<String>)/set_name(Option<String>):
required: trueThe name of the canary that you want to dry run. To find canary names, use DescribeCanaries.
code(CanaryCodeInput)/set_code(Option<CanaryCodeInput>):
required: falseUse 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 Amazon S3 bucket, the bucket name, key, and version are also included. If the script was passed into the canary directly, the script code is contained in the value of
Zipfile.If you are uploading your canary scripts with an Amazon S3 bucket, your zip file should include your script in a certain folder structure.
-
For Node.js canaries, the folder structure must be
nodejs/node_modules/myCanaryFilename.jsFor more information, see Packaging your Node.js canary files -
For Python canaries, the folder structure must be
python/myCanaryFilename.pyorpython/myFolder/myCanaryFilename.pyFor more information, see Packaging your Python canary files
-
runtime_version(impl Into<String>)/set_runtime_version(Option<String>):
required: falseSpecifies 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.
run_config(CanaryRunConfigInput)/set_run_config(Option<CanaryRunConfigInput>):
required: falseA structure that contains input information for a canary run.
vpc_config(VpcConfigInput)/set_vpc_config(Option<VpcConfigInput>):
required: falseIf this canary is to test an endpoint in a VPC, this structure contains information about the subnets and security groups of the VPC endpoint. For more information, see Running a Canary in a VPC.
execution_role_arn(impl Into<String>)/set_execution_role_arn(Option<String>):
required: falseThe ARN of the IAM role to be used to run the canary. This role must already exist, and must include
lambda.amazonaws.comas a principal in the trust policy. The role must also have the following permissions:success_retention_period_in_days(i32)/set_success_retention_period_in_days(Option<i32>):
required: falseThe 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.
failure_retention_period_in_days(i32)/set_failure_retention_period_in_days(Option<i32>):
required: falseThe 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.
visual_reference(VisualReferenceInput)/set_visual_reference(Option<VisualReferenceInput>):
required: falseAn object that specifies what screenshots to use as a baseline for visual monitoring by this canary. It can optionally also specify parts of the screenshots to ignore during the visual monitoring comparison.
Visual monitoring is supported only on canaries running the syn-puppeteer-node-3.2 runtime or later. For more information, see Visual monitoring and Visual monitoring blueprint
artifact_s3_location(impl Into<String>)/set_artifact_s3_location(Option<String>):
required: falseThe location in Amazon S3 where Synthetics stores artifacts from the test runs of this canary. Artifacts include the log file, screenshots, and HAR files. The name of the Amazon S3 bucket can’t include a period (.).
artifact_config(ArtifactConfigInput)/set_artifact_config(Option<ArtifactConfigInput>):
required: falseA structure that contains the configuration for canary artifacts, including the encryption-at-rest settings for artifacts that the canary uploads to Amazon S3.
provisioned_resource_cleanup(ProvisionedResourceCleanupSetting)/set_provisioned_resource_cleanup(Option<ProvisionedResourceCleanupSetting>):
required: falseSpecifies whether to also delete the Lambda functions and layers used by this canary when the canary is deleted. If you omit this parameter, the default of
AUTOMATICis used, which means that 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 theDeleteLambdaparameter of the DeleteCanary operation determines whether the Lambda functions and layers will be deleted.browser_configs(BrowserConfig)/set_browser_configs(Option<Vec::<BrowserConfig>>):
required: falseA structure that specifies the browser type to use for a canary run. CloudWatch Synthetics supports running canaries on both
CHROMEandFIREFOXbrowsers.If not specified,
browserConfigsdefaults to Chrome.visual_references(VisualReferenceInput)/set_visual_references(Option<Vec::<VisualReferenceInput>>):
required: falseA 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.0and above, andsyn-nodejs-playwright-3.0and above, only supportsvisualReferences.visualReferencefield is not supported.Versions older than
syn-nodejs-puppeteer-11.0supports bothvisualReferenceandvisualReferencesfor backward compatibility. It is recommended to usevisualReferencesfor consistency and future compatibility.
- On success, responds with
StartCanaryDryRunOutputwith field(s):dry_run_config(Option<DryRunConfigOutput>):Returns the dry run configurations for a canary.
- On failure, responds with
SdkError<StartCanaryDryRunError>
Source§impl Client
impl Client
Sourcepub fn stop_canary(&self) -> StopCanaryFluentBuilder
pub fn stop_canary(&self) -> StopCanaryFluentBuilder
Constructs a fluent builder for the StopCanary operation.
- The fluent builder is configurable:
name(impl Into<String>)/set_name(Option<String>):
required: trueThe name of the canary that you want to stop. To find the names of your canaries, use ListCanaries.
- On success, responds with
StopCanaryOutput - On failure, responds with
SdkError<StopCanaryError>
Source§impl Client
impl Client
Sourcepub fn tag_resource(&self) -> TagResourceFluentBuilder
pub fn tag_resource(&self) -> TagResourceFluentBuilder
Constructs a fluent builder for the TagResource operation.
- The fluent builder is configurable:
resource_arn(impl Into<String>)/set_resource_arn(Option<String>):
required: trueThe ARN of the canary or group that you’re adding tags to.
The ARN format of a canary is
arn:aws:synthetics:Region:account-id:canary:canary-name.The ARN format of a group is
arn:aws:synthetics:Region:account-id:group:group-nametags(impl Into<String>, impl Into<String>)/set_tags(Option<HashMap::<String, String>>):
required: trueThe list of key-value pairs to associate with the resource.
- On success, responds with
TagResourceOutput - On failure, responds with
SdkError<TagResourceError>
Source§impl Client
impl Client
Sourcepub fn untag_resource(&self) -> UntagResourceFluentBuilder
pub fn untag_resource(&self) -> UntagResourceFluentBuilder
Constructs a fluent builder for the UntagResource operation.
- The fluent builder is configurable:
resource_arn(impl Into<String>)/set_resource_arn(Option<String>):
required: trueThe ARN of the canary or group that you’re removing tags from.
The ARN format of a canary is
arn:aws:synthetics:Region:account-id:canary:canary-name.The ARN format of a group is
arn:aws:synthetics:Region:account-id:group:group-nametag_keys(impl Into<String>)/set_tag_keys(Option<Vec::<String>>):
required: trueThe list of tag keys to remove from the resource.
- On success, responds with
UntagResourceOutput - On failure, responds with
SdkError<UntagResourceError>
Source§impl Client
impl Client
Sourcepub fn update_canary(&self) -> UpdateCanaryFluentBuilder
pub fn update_canary(&self) -> UpdateCanaryFluentBuilder
Constructs a fluent builder for the UpdateCanary operation.
- The fluent builder is configurable:
name(impl Into<String>)/set_name(Option<String>):
required: trueThe 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(CanaryCodeInput)/set_code(Option<CanaryCodeInput>):
required: falseA structure that includes the entry point from which the canary should start running your script. If the script is stored in an Amazon S3 bucket, the bucket name, key, and version are also included.
execution_role_arn(impl Into<String>)/set_execution_role_arn(Option<String>):
required: falseThe ARN of the IAM role to be used to run the canary. This role must already exist, and must include
lambda.amazonaws.comas 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(impl Into<String>)/set_runtime_version(Option<String>):
required: falseSpecifies 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(CanaryScheduleInput)/set_schedule(Option<CanaryScheduleInput>):
required: falseA structure that contains information about how often the canary is to run, and when these runs are to stop.
run_config(CanaryRunConfigInput)/set_run_config(Option<CanaryRunConfigInput>):
required: falseA structure that contains the timeout value that is used for each individual run of the canary.
Environment variable keys and values are encrypted at rest using Amazon Web Services owned KMS keys. However, the environment variables are not encrypted on the client side. Do not store sensitive information in them.
success_retention_period_in_days(i32)/set_success_retention_period_in_days(Option<i32>):
required: falseThe number of days to retain data about successful runs of this canary.
This setting affects the range of information returned by GetCanaryRuns, as well as the range of information displayed in the Synthetics console.
failure_retention_period_in_days(i32)/set_failure_retention_period_in_days(Option<i32>):
required: falseThe number of days to retain data about failed runs of this canary.
This setting affects the range of information returned by GetCanaryRuns, as well as the range of information displayed in the Synthetics console.
vpc_config(VpcConfigInput)/set_vpc_config(Option<VpcConfigInput>):
required: falseIf 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.
visual_reference(VisualReferenceInput)/set_visual_reference(Option<VisualReferenceInput>):
required: falseDefines the screenshots to use as the baseline for comparisons during visual monitoring comparisons during future runs of this canary. If you omit this parameter, no changes are made to any baseline screenshots that the canary might be using already.
Visual monitoring is supported only on canaries running the syn-puppeteer-node-3.2 runtime or later. For more information, see Visual monitoring and Visual monitoring blueprint
artifact_s3_location(impl Into<String>)/set_artifact_s3_location(Option<String>):
required: falseThe location in Amazon S3 where Synthetics stores artifacts from the test runs of this canary. Artifacts include the log file, screenshots, and HAR files. The name of the Amazon S3 bucket can’t include a period (.).
artifact_config(ArtifactConfigInput)/set_artifact_config(Option<ArtifactConfigInput>):
required: falseA structure that contains the configuration for canary artifacts, including the encryption-at-rest settings for artifacts that the canary uploads to Amazon S3.
provisioned_resource_cleanup(ProvisionedResourceCleanupSetting)/set_provisioned_resource_cleanup(Option<ProvisionedResourceCleanupSetting>):
required: falseSpecifies whether to also delete the Lambda functions and layers used by this canary when the canary is deleted.
If the value of this parameter is
OFF, then the value of theDeleteLambdaparameter of the DeleteCanary operation determines whether the Lambda functions and layers will be deleted.dry_run_id(impl Into<String>)/set_dry_run_id(Option<String>):
required: falseUpdate the existing canary using the updated configurations from the DryRun associated with the DryRunId.
When you use the
dryRunIdfield when updating a canary, the only other field you can provide is theSchedule. Adding any other field will thrown an exception.visual_references(VisualReferenceInput)/set_visual_references(Option<Vec::<VisualReferenceInput>>):
required: falseA 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.0and above, andsyn-nodejs-playwright-3.0and above, only supportsvisualReferences.visualReferencefield is not supported.Versions older than
syn-nodejs-puppeteer-11.0supports bothvisualReferenceandvisualReferencesfor backward compatibility. It is recommended to usevisualReferencesfor consistency and future compatibility.For multibrowser visual monitoring, you can update the baseline for all configured browsers in a single update call by specifying a list of VisualReference objects, one per browser. Each VisualReference object maps to a specific browser configuration, allowing you to manage visual baselines for multiple browsers simultaneously.
For single configuration canaries using Chrome browser (default browser), use visualReferences for
syn-nodejs-puppeteer-11.0and above, andsyn-nodejs-playwright-3.0and above canaries. The browserType in the visualReference object is not mandatory.browser_configs(BrowserConfig)/set_browser_configs(Option<Vec::<BrowserConfig>>):
required: falseA structure that specifies the browser type to use for a canary run. CloudWatch Synthetics supports running canaries on both
CHROMEandFIREFOXbrowsers.If not specified,
browserConfigsdefaults to Chrome.
- On success, responds with
UpdateCanaryOutput - On failure, responds with
SdkError<UpdateCanaryError>
Source§impl Client
impl Client
Sourcepub fn from_conf(conf: Config) -> Self
pub fn from_conf(conf: Config) -> Self
Creates a new client from the service Config.
§Panics
This method will panic in the following cases:
- Retries or timeouts are enabled without a
sleep_implconfigured. - Identity caching is enabled without a
sleep_implandtime_sourceconfigured. - No
behavior_versionis provided.
The panic message for each of these will have instructions on how to resolve them.
Source§impl Client
impl Client
Sourcepub fn new(sdk_config: &SdkConfig) -> Self
pub fn new(sdk_config: &SdkConfig) -> Self
Creates a new client from an SDK Config.
§Panics
- This method will panic if the
sdk_configis missing an async sleep implementation. If you experience this panic, set thesleep_implon the Config passed into this function to fix it. - This method will panic if the
sdk_configis missing an HTTP connector. If you experience this panic, set thehttp_connectoron the Config passed into this function to fix it. - This method will panic if no
BehaviorVersionis provided. If you experience this panic, setbehavior_versionon the Config or enable thebehavior-version-latestCargo feature.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);