startCanaryDryRun method

Future<StartCanaryDryRunResponse> startCanaryDryRun({
  1. required String name,
  2. ArtifactConfigInput? artifactConfig,
  3. String? artifactS3Location,
  4. List<BrowserConfig>? browserConfigs,
  5. CanaryCodeInput? code,
  6. String? executionRoleArn,
  7. int? failureRetentionPeriodInDays,
  8. ProvisionedResourceCleanupSetting? provisionedResourceCleanup,
  9. CanaryRunConfigInput? runConfig,
  10. String? runtimeVersion,
  11. int? successRetentionPeriodInDays,
  12. VisualReferenceInput? visualReference,
  13. List<VisualReferenceInput>? visualReferences,
  14. VpcConfigInput? vpcConfig,
})

Use this operation to start a dry run for a canary that has already been created

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ValidationException.

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

Parameter artifactS3Location : 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. The name of the Amazon S3 bucket can't include a period (.).

Parameter browserConfigs : A structure that specifies the browser type to use for a canary run. CloudWatch Synthetics supports running canaries on both CHROME and FIREFOX browsers.

Parameter executionRoleArn : 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:

Parameter failureRetentionPeriodInDays : 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.

Parameter provisionedResourceCleanup : Specifies 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 AUTOMATIC is 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 the DeleteLambda parameter of the DeleteCanary operation determines whether the Lambda functions and layers will be deleted.

Parameter runtimeVersion : 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.

Parameter successRetentionPeriodInDays : 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.

Parameter visualReferences : 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 visualReferences. visualReference field is not supported.

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

Implementation

Future<StartCanaryDryRunResponse> startCanaryDryRun({
  required String name,
  ArtifactConfigInput? artifactConfig,
  String? artifactS3Location,
  List<BrowserConfig>? browserConfigs,
  CanaryCodeInput? code,
  String? executionRoleArn,
  int? failureRetentionPeriodInDays,
  ProvisionedResourceCleanupSetting? provisionedResourceCleanup,
  CanaryRunConfigInput? runConfig,
  String? runtimeVersion,
  int? successRetentionPeriodInDays,
  VisualReferenceInput? visualReference,
  List<VisualReferenceInput>? visualReferences,
  VpcConfigInput? vpcConfig,
}) async {
  _s.validateNumRange(
    'failureRetentionPeriodInDays',
    failureRetentionPeriodInDays,
    1,
    1024,
  );
  _s.validateNumRange(
    'successRetentionPeriodInDays',
    successRetentionPeriodInDays,
    1,
    1024,
  );
  final $payload = <String, dynamic>{
    if (artifactConfig != null) 'ArtifactConfig': artifactConfig,
    if (artifactS3Location != null) 'ArtifactS3Location': artifactS3Location,
    if (browserConfigs != null) 'BrowserConfigs': browserConfigs,
    if (code != null) 'Code': code,
    if (executionRoleArn != null) 'ExecutionRoleArn': executionRoleArn,
    if (failureRetentionPeriodInDays != null)
      'FailureRetentionPeriodInDays': failureRetentionPeriodInDays,
    if (provisionedResourceCleanup != null)
      'ProvisionedResourceCleanup': provisionedResourceCleanup.value,
    if (runConfig != null) 'RunConfig': runConfig,
    if (runtimeVersion != null) 'RuntimeVersion': runtimeVersion,
    if (successRetentionPeriodInDays != null)
      'SuccessRetentionPeriodInDays': successRetentionPeriodInDays,
    if (visualReference != null) 'VisualReference': visualReference,
    if (visualReferences != null) 'VisualReferences': visualReferences,
    if (vpcConfig != null) 'VpcConfig': vpcConfig,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/canary/${Uri.encodeComponent(name)}/dry-run/start',
    exceptionFnMap: _exceptionFns,
  );
  return StartCanaryDryRunResponse.fromJson(response);
}