{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--aws-synthetics-canary.json",
  "title": "AWSSyntheticsCanaryProperties",
  "description": "Resource Type definition for AWS::Synthetics::Canary. Source:- <https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-synthetics>",
  "x-lintel": {
    "source": "https://raw.githubusercontent.com/lalcebo/json-schema/master/serverless/resources/cloudformation-modified/aws-synthetics-canary.json",
    "sourceSha256": "46133b9bf55b692b5e376e6d23c5155cedf14f5a7b75d0ffe9a84a368b8bb52d"
  },
  "type": "object",
  "properties": {
    "Name": {
      "oneOf": [
        {
          "type": "string",
          "pattern": "^[0-9a-z_\\-]{1,21}$"
        },
        {
          "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
        }
      ],
      "description": "Name of the canary."
    },
    "Code": {
      "description": "Provide the canary script source",
      "$ref": "#/$defs/Code"
    },
    "ArtifactS3Location": {
      "oneOf": [
        {
          "type": "string",
          "pattern": "^(s3|S3)://"
        },
        {
          "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
        }
      ],
      "description": "Provide the s3 bucket output location for test results"
    },
    "ArtifactConfig": {
      "description": "Provide artifact configuration",
      "$ref": "#/$defs/ArtifactConfig"
    },
    "Schedule": {
      "description": "Frequency to run your canaries",
      "$ref": "#/$defs/Schedule"
    },
    "ExecutionRoleArn": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
        }
      ],
      "description": "Lambda Execution role used to run your canaries"
    },
    "RuntimeVersion": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
        }
      ],
      "description": "Runtime version of Synthetics Library"
    },
    "SuccessRetentionPeriod": {
      "description": "Retention period of successful canary runs represented in number of days",
      "type": "integer"
    },
    "FailureRetentionPeriod": {
      "description": "Retention period of failed canary runs represented in number of days",
      "type": "integer"
    },
    "Tags": {
      "type": "array",
      "uniqueItems": false,
      "items": {
        "$ref": "#/$defs/Tag"
      }
    },
    "VPCConfig": {
      "description": "Provide VPC Configuration if enabled.",
      "$ref": "#/$defs/VPCConfig"
    },
    "RunConfig": {
      "description": "Provide canary run configuration",
      "$ref": "#/$defs/RunConfig"
    },
    "StartCanaryAfterCreation": {
      "description": "Runs canary if set to True. Default is False",
      "type": "boolean"
    },
    "VisualReference": {
      "description": "Visual reference configuration for visual testing",
      "$ref": "#/$defs/VisualReference"
    },
    "DeleteLambdaResourcesOnCanaryDeletion": {
      "description": "Deletes associated lambda resources created by Synthetics if set to True. Default is False",
      "type": "boolean"
    }
  },
  "typeName": "AWS::Synthetics::Canary",
  "deprecatedProperties": [
    "/properties/DeleteLambdaResourcesOnCanaryDeletion"
  ],
  "sourceUrl": "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-synthetics",
  "writeOnlyProperties": [
    "/properties/Code/S3Bucket",
    "/properties/Code/S3Key",
    "/properties/Code/S3ObjectVersion",
    "/properties/Code/Script",
    "/properties/DeleteLambdaResourcesOnCanaryDeletion",
    "/properties/StartCanaryAfterCreation",
    "/properties/RunConfig/EnvironmentVariables",
    "/properties/VisualReference"
  ],
  "additionalProperties": false,
  "required": [
    "Name",
    "Code",
    "ArtifactS3Location",
    "ExecutionRoleArn",
    "Schedule",
    "RuntimeVersion"
  ],
  "$defs": {
    "Schedule": {
      "type": "object",
      "title": "AWSSyntheticsCanaryScheduleDefinition",
      "properties": {
        "Expression": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
            }
          ]
        },
        "DurationInSeconds": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
            }
          ]
        }
      },
      "required": [
        "Expression"
      ],
      "additionalProperties": false
    },
    "Code": {
      "type": "object",
      "title": "AWSSyntheticsCanaryCodeDefinition",
      "properties": {
        "S3Bucket": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
            }
          ]
        },
        "S3Key": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
            }
          ]
        },
        "S3ObjectVersion": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
            }
          ]
        },
        "Script": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
            }
          ]
        },
        "Handler": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
            }
          ]
        },
        "SourceLocationArn": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
            }
          ]
        }
      },
      "required": [
        "Handler"
      ],
      "oneOf": [
        {
          "required": [
            "S3Bucket",
            "S3Key"
          ]
        },
        {
          "required": [
            "Script"
          ]
        }
      ],
      "additionalProperties": false
    },
    "Tag": {
      "description": "A key-value pair to associate with a resource.",
      "title": "AWSSyntheticsCanaryTagDefinition",
      "type": "object",
      "properties": {
        "Key": {
          "oneOf": [
            {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
            }
          ],
          "description": "The key name of the tag. You can specify a value that is 1 to 127 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -. "
        },
        "Value": {
          "oneOf": [
            {
              "type": "string",
              "minLength": 0,
              "maxLength": 256
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
            }
          ],
          "description": "The value for the tag. You can specify a value that is 1 to 255 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -. "
        }
      },
      "required": [
        "Value",
        "Key"
      ],
      "additionalProperties": false
    },
    "VPCConfig": {
      "type": "object",
      "title": "AWSSyntheticsCanaryVPCConfigDefinition",
      "properties": {
        "VpcId": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
            }
          ]
        },
        "SubnetIds": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "SecurityGroupIds": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "SubnetIds",
        "SecurityGroupIds"
      ],
      "additionalProperties": false
    },
    "RunConfig": {
      "type": "object",
      "title": "AWSSyntheticsCanaryRunConfigDefinition",
      "properties": {
        "TimeoutInSeconds": {
          "description": "Provide maximum canary timeout per run in seconds",
          "type": "integer"
        },
        "MemoryInMB": {
          "description": "Provide maximum memory available for canary in MB",
          "type": "integer"
        },
        "ActiveTracing": {
          "description": "Enable active tracing if set to true",
          "type": "boolean"
        },
        "EnvironmentVariables": {
          "type": "object",
          "additionalProperties": false,
          "description": "Environment variable key-value pairs.",
          "patternProperties": {
            "[a-zA-Z][a-zA-Z0-9_]+": {
              "type": "string"
            }
          }
        }
      },
      "additionalProperties": false
    },
    "VisualReference": {
      "type": "object",
      "title": "AWSSyntheticsCanaryVisualReferenceDefinition",
      "properties": {
        "BaseCanaryRunId": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
            }
          ],
          "description": "Canary run id to be used as base reference for visual testing"
        },
        "BaseScreenshots": {
          "type": "array",
          "description": "List of screenshots used as base reference for visual testing",
          "items": {
            "$ref": "#/$defs/BaseScreenshot"
          }
        }
      },
      "required": [
        "BaseCanaryRunId"
      ],
      "additionalProperties": false
    },
    "BaseScreenshot": {
      "type": "object",
      "properties": {
        "ScreenshotName": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
            }
          ],
          "description": "Name of the screenshot to be used as base reference for visual testing"
        },
        "IgnoreCoordinates": {
          "type": "array",
          "description": "List of coordinates of rectangles to be ignored during visual testing",
          "items": {
            "type": "string",
            "description": "Coordinates of a rectangle to be ignored during visual testing"
          }
        }
      },
      "required": [
        "ScreenshotName"
      ],
      "title": "AWSSyntheticsCanaryBaseScreenshotDefinition"
    },
    "ArtifactConfig": {
      "type": "object",
      "title": "AWSSyntheticsCanaryArtifactConfigDefinition",
      "properties": {
        "S3Encryption": {
          "$ref": "#/$defs/S3Encryption",
          "description": "Encryption configuration for uploading artifacts to S3"
        }
      },
      "additionalProperties": false
    },
    "S3Encryption": {
      "type": "object",
      "title": "AWSSyntheticsCanaryS3EncryptionDefinition",
      "properties": {
        "EncryptionMode": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
            }
          ],
          "description": "Encryption mode for encrypting artifacts when uploading to S3. Valid values: SSE_S3 and SSE_KMS."
        },
        "KmsKeyArn": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_FunctionString"
            }
          ],
          "description": "KMS key Arn for encrypting artifacts when uploading to S3. You must specify KMS key Arn for SSE_KMS encryption mode only."
        }
      },
      "additionalProperties": false
    }
  },
  "createOnlyProperties": [
    "/properties/Name"
  ],
  "primaryIdentifier": [
    "/properties/Name"
  ],
  "readOnlyProperties": [
    "/properties/Id",
    "/properties/State",
    "/properties/Code/SourceLocationArn"
  ]
}
