//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2020 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto/tree/main/CodeGenerator. DO NOT EDIT.

import Foundation
import SotoCore

extension Synthetics {
    // MARK: Enums

    public enum CanaryRunState: String, CustomStringConvertible, Codable {
        case failed = "FAILED"
        case passed = "PASSED"
        case running = "RUNNING"
        public var description: String { return self.rawValue }
    }

    public enum CanaryRunStateReasonCode: String, CustomStringConvertible, Codable {
        case canaryFailure = "CANARY_FAILURE"
        case executionFailure = "EXECUTION_FAILURE"
        public var description: String { return self.rawValue }
    }

    public enum CanaryState: String, CustomStringConvertible, Codable {
        case creating = "CREATING"
        case deleting = "DELETING"
        case error = "ERROR"
        case ready = "READY"
        case running = "RUNNING"
        case starting = "STARTING"
        case stopped = "STOPPED"
        case stopping = "STOPPING"
        case updating = "UPDATING"
        public var description: String { return self.rawValue }
    }

    public enum CanaryStateReasonCode: String, CustomStringConvertible, Codable {
        case invalidPermissions = "INVALID_PERMISSIONS"
        public var description: String { return self.rawValue }
    }

    // MARK: Shapes

    public struct Canary: AWSDecodableShape {
        /// The location in Amazon S3 where Synthetics stores artifacts from the runs of this canary. Artifacts include the log file, screenshots, and HAR files.
        public let artifactS3Location: String?
        public let code: CanaryCodeOutput?
        /// The ARN of the Lambda function that is used as your canary's engine. For more information about Lambda ARN format, see Resources and Conditions for Lambda Actions.
        public let engineArn: String?
        /// The ARN of the IAM role used to run the canary. This role must include lambda.amazonaws.com as a principal in the trust policy.
        public let executionRoleArn: String?
        /// The number of days to retain data about failed runs of this canary.
        public let failureRetentionPeriodInDays: Int?
        /// The unique ID of this canary.
        public let id: String?
        /// The name of the canary.
        public let name: String?
        public let runConfig: CanaryRunConfigOutput?
        /// Specifies the runtime version to use for the canary. For more information about runtime versions, see  Canary Runtime Versions.
        public let runtimeVersion: String?
        /// A structure that contains information about how often the canary is to run, and when these runs are to stop.
        public let schedule: CanaryScheduleOutput?
        /// A structure that contains information about the canary's status.
        public let status: CanaryStatus?
        /// The number of days to retain data about successful runs of this canary.
        public let successRetentionPeriodInDays: Int?
        /// The list of key-value pairs that are associated with the canary.
        public let tags: [String: String]?
        /// A structure that contains information about when the canary was created, modified, and most recently run.
        public let timeline: CanaryTimeline?
        public let vpcConfig: VpcConfigOutput?

        public init(artifactS3Location: String? = nil, code: CanaryCodeOutput? = nil, engineArn: String? = nil, executionRoleArn: String? = nil, failureRetentionPeriodInDays: Int? = nil, id: String? = nil, name: String? = nil, runConfig: CanaryRunConfigOutput? = nil, runtimeVersion: String? = nil, schedule: CanaryScheduleOutput? = nil, status: CanaryStatus? = nil, successRetentionPeriodInDays: Int? = nil, tags: [String: String]? = nil, timeline: CanaryTimeline? = nil, vpcConfig: VpcConfigOutput? = nil) {
            self.artifactS3Location = artifactS3Location
            self.code = code
            self.engineArn = engineArn
            self.executionRoleArn = executionRoleArn
            self.failureRetentionPeriodInDays = failureRetentionPeriodInDays
            self.id = id
            self.name = name
            self.runConfig = runConfig
            self.runtimeVersion = runtimeVersion
            self.schedule = schedule
            self.status = status
            self.successRetentionPeriodInDays = successRetentionPeriodInDays
            self.tags = tags
            self.timeline = timeline
            self.vpcConfig = vpcConfig
        }

        private enum CodingKeys: String, CodingKey {
            case artifactS3Location = "ArtifactS3Location"
            case code = "Code"
            case engineArn = "EngineArn"
            case executionRoleArn = "ExecutionRoleArn"
            case failureRetentionPeriodInDays = "FailureRetentionPeriodInDays"
            case id = "Id"
            case name = "Name"
            case runConfig = "RunConfig"
            case runtimeVersion = "RuntimeVersion"
            case schedule = "Schedule"
            case status = "Status"
            case successRetentionPeriodInDays = "SuccessRetentionPeriodInDays"
            case tags = "Tags"
            case timeline = "Timeline"
            case vpcConfig = "VpcConfig"
        }
    }

    public struct CanaryCodeInput: AWSEncodableShape {
        /// The entry point to use for the source code when running the canary. This value must end with the string .handler.
        public let handler: String
        /// If your canary script is located in S3, specify the full bucket name here. The bucket must already exist. Specify the full bucket name, including s3:// as the start of the bucket name.
        public let s3Bucket: String?
        /// The S3 key of your script. For more information, see Working with Amazon S3 Objects.
        public let s3Key: String?
        /// The S3 version ID of your script.
        public let s3Version: String?
        /// If you input your canary script directly into the canary instead of referring to an S3 location, the value of this parameter is the .zip file that contains the script. It can be up to 5 MB.
        public let zipFile: Data?

        public init(handler: String, s3Bucket: String? = nil, s3Key: String? = nil, s3Version: String? = nil, zipFile: Data? = nil) {
            self.handler = handler
            self.s3Bucket = s3Bucket
            self.s3Key = s3Key
            self.s3Version = s3Version
            self.zipFile = zipFile
        }

        public func validate(name: String) throws {
            try self.validate(self.handler, name: "handler", parent: name, max: 1024)
            try self.validate(self.handler, name: "handler", parent: name, min: 1)
            try self.validate(self.s3Bucket, name: "s3Bucket", parent: name, max: 1024)
            try self.validate(self.s3Bucket, name: "s3Bucket", parent: name, min: 1)
            try self.validate(self.s3Key, name: "s3Key", parent: name, max: 1024)
            try self.validate(self.s3Key, name: "s3Key", parent: name, min: 1)
            try self.validate(self.s3Version, name: "s3Version", parent: name, max: 1024)
            try self.validate(self.s3Version, name: "s3Version", parent: name, min: 1)
            try self.validate(self.zipFile, name: "zipFile", parent: name, max: 10_000_000)
            try self.validate(self.zipFile, name: "zipFile", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case handler = "Handler"
            case s3Bucket = "S3Bucket"
            case s3Key = "S3Key"
            case s3Version = "S3Version"
            case zipFile = "ZipFile"
        }
    }

    public struct CanaryCodeOutput: AWSDecodableShape {
        /// The entry point to use for the source code when running the canary.
        public let handler: String?
        /// The ARN of the Lambda layer where Synthetics stores the canary script code.
        public let sourceLocationArn: String?

        public init(handler: String? = nil, sourceLocationArn: String? = nil) {
            self.handler = handler
            self.sourceLocationArn = sourceLocationArn
        }

        private enum CodingKeys: String, CodingKey {
            case handler = "Handler"
            case sourceLocationArn = "SourceLocationArn"
        }
    }

    public struct CanaryLastRun: AWSDecodableShape {
        /// The name of the canary.
        public let canaryName: String?
        /// The results from this canary's most recent run.
        public let lastRun: CanaryRun?

        public init(canaryName: String? = nil, lastRun: CanaryRun? = nil) {
            self.canaryName = canaryName
            self.lastRun = lastRun
        }

        private enum CodingKeys: String, CodingKey {
            case canaryName = "CanaryName"
            case lastRun = "LastRun"
        }
    }

    public struct CanaryRun: AWSDecodableShape {
        /// The location where the canary stored artifacts from the run. Artifacts include the log file, screenshots, and HAR files.
        public let artifactS3Location: String?
        /// A unique ID that identifies this canary run.
        public let id: String?
        /// The name of the canary.
        public let name: String?
        /// The status of this run.
        public let status: CanaryRunStatus?
        /// A structure that contains the start and end times of this run.
        public let timeline: CanaryRunTimeline?

        public init(artifactS3Location: String? = nil, id: String? = nil, name: String? = nil, status: CanaryRunStatus? = nil, timeline: CanaryRunTimeline? = nil) {
            self.artifactS3Location = artifactS3Location
            self.id = id
            self.name = name
            self.status = status
            self.timeline = timeline
        }

        private enum CodingKeys: String, CodingKey {
            case artifactS3Location = "ArtifactS3Location"
            case id = "Id"
            case name = "Name"
            case status = "Status"
            case timeline = "Timeline"
        }
    }

    public struct CanaryRunConfigInput: AWSEncodableShape {
        /// Specifies whether this canary is to use active AWS X-Ray tracing when it runs. Active tracing enables this canary run to be displayed in the ServiceLens and X-Ray service maps even if the canary does not hit an endpoint that has X-ray tracing enabled. Using X-Ray tracing incurs charges. For more information, see  Canaries and X-Ray tracing. You can enable active tracing only for canaries that use version syn-nodejs-2.0 or later for their canary runtime.
        public let activeTracing: Bool?
        /// Specifies the keys and values to use for any environment variables used in the canary script. Use the following format: { "key1" : "value1", "key2" : "value2", ...} Keys must start with a letter and be at least two characters. The total size of your environment variables cannot exceed 4 KB. You can't specify any Lambda reserved environment variables as the keys for your environment variables. For more information about reserved keys, see  Runtime environment variables.
        public let environmentVariables: [String: String]?
        /// The maximum amount of memory available to the canary while it is running, in MB. This value must be a multiple of 64.
        public let memoryInMB: Int?
        /// How long the canary is allowed to run before it must stop. You can't set this time to be longer than the frequency of the runs of this canary. If you omit this field, the frequency of the canary is used as this value, up to a maximum of 14 minutes.
        public let timeoutInSeconds: Int?

        public init(activeTracing: Bool? = nil, environmentVariables: [String: String]? = nil, memoryInMB: Int? = nil, timeoutInSeconds: Int? = nil) {
            self.activeTracing = activeTracing
            self.environmentVariables = environmentVariables
            self.memoryInMB = memoryInMB
            self.timeoutInSeconds = timeoutInSeconds
        }

        public func validate(name: String) throws {
            try self.environmentVariables?.forEach {
                try validate($0.key, name: "environmentVariables.key", parent: name, pattern: "[a-zA-Z]([a-zA-Z0-9_])+")
            }
            try self.validate(self.memoryInMB, name: "memoryInMB", parent: name, max: 3008)
            try self.validate(self.memoryInMB, name: "memoryInMB", parent: name, min: 960)
            try self.validate(self.timeoutInSeconds, name: "timeoutInSeconds", parent: name, max: 840)
            try self.validate(self.timeoutInSeconds, name: "timeoutInSeconds", parent: name, min: 3)
        }

        private enum CodingKeys: String, CodingKey {
            case activeTracing = "ActiveTracing"
            case environmentVariables = "EnvironmentVariables"
            case memoryInMB = "MemoryInMB"
            case timeoutInSeconds = "TimeoutInSeconds"
        }
    }

    public struct CanaryRunConfigOutput: AWSDecodableShape {
        /// Displays whether this canary run used active AWS X-Ray tracing.
        public let activeTracing: Bool?
        /// The maximum amount of memory available to the canary while it is running, in MB. This value must be a multiple of 64.
        public let memoryInMB: Int?
        /// How long the canary is allowed to run before it must stop.
        public let timeoutInSeconds: Int?

        public init(activeTracing: Bool? = nil, memoryInMB: Int? = nil, timeoutInSeconds: Int? = nil) {
            self.activeTracing = activeTracing
            self.memoryInMB = memoryInMB
            self.timeoutInSeconds = timeoutInSeconds
        }

        private enum CodingKeys: String, CodingKey {
            case activeTracing = "ActiveTracing"
            case memoryInMB = "MemoryInMB"
            case timeoutInSeconds = "TimeoutInSeconds"
        }
    }

    public struct CanaryRunStatus: AWSDecodableShape {
        /// The current state of the run.
        public let state: CanaryRunState?
        /// If run of the canary failed, this field contains the reason for the error.
        public let stateReason: String?
        /// If this value is CANARY_FAILURE, an exception occurred in the canary code. If this value is EXECUTION_FAILURE, an exception occurred in CloudWatch Synthetics.
        public let stateReasonCode: CanaryRunStateReasonCode?

        public init(state: CanaryRunState? = nil, stateReason: String? = nil, stateReasonCode: CanaryRunStateReasonCode? = nil) {
            self.state = state
            self.stateReason = stateReason
            self.stateReasonCode = stateReasonCode
        }

        private enum CodingKeys: String, CodingKey {
            case state = "State"
            case stateReason = "StateReason"
            case stateReasonCode = "StateReasonCode"
        }
    }

    public struct CanaryRunTimeline: AWSDecodableShape {
        /// The end time of the run.
        public let completed: Date?
        /// The start time of the run.
        public let started: Date?

        public init(completed: Date? = nil, started: Date? = nil) {
            self.completed = completed
            self.started = started
        }

        private enum CodingKeys: String, CodingKey {
            case completed = "Completed"
            case started = "Started"
        }
    }

    public struct CanaryScheduleInput: AWSEncodableShape {
        /// How long, in seconds, for the canary to continue making regular runs according to the schedule in the Expression value. If you specify 0, the canary continues making runs until you stop it. If you omit this field, the default of 0 is used.
        public let durationInSeconds: Int64?
        /// A rate expression that defines how often the canary is to run. The syntax is rate(number unit). unit can be minute, minutes, or hour.  For example, rate(1 minute) runs the canary once a minute, rate(10 minutes) runs it once every 10 minutes, and rate(1 hour) runs it once every hour. You can specify a frequency between rate(1 minute) and rate(1 hour). Specifying rate(0 minute) or rate(0 hour) is a special value that causes the canary to run only once when it is started.
        public let expression: String

        public init(durationInSeconds: Int64? = nil, expression: String) {
            self.durationInSeconds = durationInSeconds
            self.expression = expression
        }

        public func validate(name: String) throws {
            try self.validate(self.durationInSeconds, name: "durationInSeconds", parent: name, max: 31_622_400)
            try self.validate(self.durationInSeconds, name: "durationInSeconds", parent: name, min: 0)
            try self.validate(self.expression, name: "expression", parent: name, max: 1024)
            try self.validate(self.expression, name: "expression", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case durationInSeconds = "DurationInSeconds"
            case expression = "Expression"
        }
    }

    public struct CanaryScheduleOutput: AWSDecodableShape {
        /// How long, in seconds, for the canary to continue making regular runs after it was created. The runs are performed according to the schedule in the Expression value.
        public let durationInSeconds: Int64?
        /// A rate expression that defines how often the canary is to run. The syntax is rate(number unit). unit can be minute, minutes, or hour.  For example, rate(1 minute) runs the canary once a minute, rate(10 minutes) runs it once every 10 minutes, and rate(1 hour) runs it once every hour. Specifying rate(0 minute) or rate(0 hour) is a special value that causes the canary to run only once when it is started.
        public let expression: String?

        public init(durationInSeconds: Int64? = nil, expression: String? = nil) {
            self.durationInSeconds = durationInSeconds
            self.expression = expression
        }

        private enum CodingKeys: String, CodingKey {
            case durationInSeconds = "DurationInSeconds"
            case expression = "Expression"
        }
    }

    public struct CanaryStatus: AWSDecodableShape {
        /// The current state of the canary.
        public let state: CanaryState?
        /// If the canary has insufficient permissions to run, this field provides more details.
        public let stateReason: String?
        /// If the canary cannot run or has failed, this field displays the reason.
        public let stateReasonCode: CanaryStateReasonCode?

        public init(state: CanaryState? = nil, stateReason: String? = nil, stateReasonCode: CanaryStateReasonCode? = nil) {
            self.state = state
            self.stateReason = stateReason
            self.stateReasonCode = stateReasonCode
        }

        private enum CodingKeys: String, CodingKey {
            case state = "State"
            case stateReason = "StateReason"
            case stateReasonCode = "StateReasonCode"
        }
    }

    public struct CanaryTimeline: AWSDecodableShape {
        /// The date and time the canary was created.
        public let created: Date?
        /// The date and time the canary was most recently modified.
        public let lastModified: Date?
        /// The date and time that the canary's most recent run started.
        public let lastStarted: Date?
        /// The date and time that the canary's most recent run ended.
        public let lastStopped: Date?

        public init(created: Date? = nil, lastModified: Date? = nil, lastStarted: Date? = nil, lastStopped: Date? = nil) {
            self.created = created
            self.lastModified = lastModified
            self.lastStarted = lastStarted
            self.lastStopped = lastStopped
        }

        private enum CodingKeys: String, CodingKey {
            case created = "Created"
            case lastModified = "LastModified"
            case lastStarted = "LastStarted"
            case lastStopped = "LastStopped"
        }
    }

    public struct CreateCanaryRequest: AWSEncodableShape {
        /// 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.
        public let artifactS3Location: String
        /// 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.
        public let code: CanaryCodeInput
        /// 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
        public let executionRoleArn: String
        /// 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.
        public let failureRetentionPeriodInDays: Int?
        /// 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.
        public let name: String
        /// A structure that contains the configuration for individual canary runs, such as timeout value.
        public let runConfig: CanaryRunConfigInput?
        /// 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.
        public let runtimeVersion: String
        /// A structure that contains information about how often the canary is to run and when these test runs are to stop.
        public let schedule: CanaryScheduleInput
        /// 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.
        public let successRetentionPeriodInDays: Int?
        /// 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.
        public let tags: [String: String]?
        /// 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.
        public let vpcConfig: VpcConfigInput?

        public init(artifactS3Location: String, code: CanaryCodeInput, executionRoleArn: String, failureRetentionPeriodInDays: Int? = nil, name: String, runConfig: CanaryRunConfigInput? = nil, runtimeVersion: String, schedule: CanaryScheduleInput, successRetentionPeriodInDays: Int? = nil, tags: [String: String]? = nil, vpcConfig: VpcConfigInput? = nil) {
            self.artifactS3Location = artifactS3Location
            self.code = code
            self.executionRoleArn = executionRoleArn
            self.failureRetentionPeriodInDays = failureRetentionPeriodInDays
            self.name = name
            self.runConfig = runConfig
            self.runtimeVersion = runtimeVersion
            self.schedule = schedule
            self.successRetentionPeriodInDays = successRetentionPeriodInDays
            self.tags = tags
            self.vpcConfig = vpcConfig
        }

        public func validate(name: String) throws {
            try self.validate(self.artifactS3Location, name: "artifactS3Location", parent: name, max: 1024)
            try self.validate(self.artifactS3Location, name: "artifactS3Location", parent: name, min: 1)
            try self.code.validate(name: "\(name).code")
            try self.validate(self.executionRoleArn, name: "executionRoleArn", parent: name, max: 2048)
            try self.validate(self.executionRoleArn, name: "executionRoleArn", parent: name, min: 1)
            try self.validate(self.executionRoleArn, name: "executionRoleArn", parent: name, pattern: "arn:(aws[a-zA-Z-]*)?:iam::\\d{12}:role/?[a-zA-Z_0-9+=,.@\\-_/]+")
            try self.validate(self.failureRetentionPeriodInDays, name: "failureRetentionPeriodInDays", parent: name, max: 1024)
            try self.validate(self.failureRetentionPeriodInDays, name: "failureRetentionPeriodInDays", parent: name, min: 1)
            try self.validate(self.name, name: "name", parent: name, max: 21)
            try self.validate(self.name, name: "name", parent: name, min: 1)
            try self.validate(self.name, name: "name", parent: name, pattern: "^[0-9a-z_\\-]+$")
            try self.runConfig?.validate(name: "\(name).runConfig")
            try self.validate(self.runtimeVersion, name: "runtimeVersion", parent: name, max: 1024)
            try self.validate(self.runtimeVersion, name: "runtimeVersion", parent: name, min: 1)
            try self.schedule.validate(name: "\(name).schedule")
            try self.validate(self.successRetentionPeriodInDays, name: "successRetentionPeriodInDays", parent: name, max: 1024)
            try self.validate(self.successRetentionPeriodInDays, name: "successRetentionPeriodInDays", parent: name, min: 1)
            try self.tags?.forEach {
                try validate($0.key, name: "tags.key", parent: name, max: 128)
                try validate($0.key, name: "tags.key", parent: name, min: 1)
                try validate($0.key, name: "tags.key", parent: name, pattern: "^(?!aws:)[a-zA-Z+-=._:/]+$")
                try validate($0.value, name: "tags[\"\($0.key)\"]", parent: name, max: 256)
            }
            try self.vpcConfig?.validate(name: "\(name).vpcConfig")
        }

        private enum CodingKeys: String, CodingKey {
            case artifactS3Location = "ArtifactS3Location"
            case code = "Code"
            case executionRoleArn = "ExecutionRoleArn"
            case failureRetentionPeriodInDays = "FailureRetentionPeriodInDays"
            case name = "Name"
            case runConfig = "RunConfig"
            case runtimeVersion = "RuntimeVersion"
            case schedule = "Schedule"
            case successRetentionPeriodInDays = "SuccessRetentionPeriodInDays"
            case tags = "Tags"
            case vpcConfig = "VpcConfig"
        }
    }

    public struct CreateCanaryResponse: AWSDecodableShape {
        /// The full details about the canary you have created.
        public let canary: Canary?

        public init(canary: Canary? = nil) {
            self.canary = canary
        }

        private enum CodingKeys: String, CodingKey {
            case canary = "Canary"
        }
    }

    public struct DeleteCanaryRequest: AWSEncodableShape {
        public static var _encoding = [
            AWSMemberEncoding(label: "name", location: .uri(locationName: "name"))
        ]

        /// The name of the canary that you want to delete. To find the names of your canaries, use DescribeCanaries.
        public let name: String

        public init(name: String) {
            self.name = name
        }

        public func validate(name: String) throws {
            try self.validate(self.name, name: "name", parent: name, max: 21)
            try self.validate(self.name, name: "name", parent: name, min: 1)
            try self.validate(self.name, name: "name", parent: name, pattern: "^[0-9a-z_\\-]+$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct DeleteCanaryResponse: AWSDecodableShape {
        public init() {}
    }

    public struct DescribeCanariesLastRunRequest: AWSEncodableShape {
        /// 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.
        public let maxResults: Int?
        /// 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.
        public let nextToken: String?

        public init(maxResults: Int? = nil, nextToken: String? = nil) {
            self.maxResults = maxResults
            self.nextToken = nextToken
        }

        public func validate(name: String) throws {
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 100)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, max: 252)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 4)
        }

        private enum CodingKeys: String, CodingKey {
            case maxResults = "MaxResults"
            case nextToken = "NextToken"
        }
    }

    public struct DescribeCanariesLastRunResponse: AWSDecodableShape {
        /// An array that contains the information from the most recent run of each canary.
        public let canariesLastRun: [CanaryLastRun]?
        /// A token that indicates that there is more data available. You can use this token in a subsequent DescribeCanariesLastRun operation to retrieve the next set of results.
        public let nextToken: String?

        public init(canariesLastRun: [CanaryLastRun]? = nil, nextToken: String? = nil) {
            self.canariesLastRun = canariesLastRun
            self.nextToken = nextToken
        }

        private enum CodingKeys: String, CodingKey {
            case canariesLastRun = "CanariesLastRun"
            case nextToken = "NextToken"
        }
    }

    public struct DescribeCanariesRequest: AWSEncodableShape {
        /// 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.
        public let maxResults: Int?
        /// 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.
        public let nextToken: String?

        public init(maxResults: Int? = nil, nextToken: String? = nil) {
            self.maxResults = maxResults
            self.nextToken = nextToken
        }

        public func validate(name: String) throws {
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 20)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, max: 252)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 4)
        }

        private enum CodingKeys: String, CodingKey {
            case maxResults = "MaxResults"
            case nextToken = "NextToken"
        }
    }

    public struct DescribeCanariesResponse: AWSDecodableShape {
        /// Returns an array. Each item in the array contains the full information about one canary.
        public let canaries: [Canary]?
        /// 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.
        public let nextToken: String?

        public init(canaries: [Canary]? = nil, nextToken: String? = nil) {
            self.canaries = canaries
            self.nextToken = nextToken
        }

        private enum CodingKeys: String, CodingKey {
            case canaries = "Canaries"
            case nextToken = "NextToken"
        }
    }

    public struct DescribeRuntimeVersionsRequest: AWSEncodableShape {
        /// 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.
        public let maxResults: Int?
        /// 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.
        public let nextToken: String?

        public init(maxResults: Int? = nil, nextToken: String? = nil) {
            self.maxResults = maxResults
            self.nextToken = nextToken
        }

        public func validate(name: String) throws {
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 100)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, max: 252)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 4)
        }

        private enum CodingKeys: String, CodingKey {
            case maxResults = "MaxResults"
            case nextToken = "NextToken"
        }
    }

    public struct DescribeRuntimeVersionsResponse: AWSDecodableShape {
        /// 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.
        public let nextToken: String?
        /// An array of objects that display the details about each Synthetics canary runtime version.
        public let runtimeVersions: [RuntimeVersion]?

        public init(nextToken: String? = nil, runtimeVersions: [RuntimeVersion]? = nil) {
            self.nextToken = nextToken
            self.runtimeVersions = runtimeVersions
        }

        private enum CodingKeys: String, CodingKey {
            case nextToken = "NextToken"
            case runtimeVersions = "RuntimeVersions"
        }
    }

    public struct GetCanaryRequest: AWSEncodableShape {
        public static var _encoding = [
            AWSMemberEncoding(label: "name", location: .uri(locationName: "name"))
        ]

        /// The name of the canary that you want details for.
        public let name: String

        public init(name: String) {
            self.name = name
        }

        public func validate(name: String) throws {
            try self.validate(self.name, name: "name", parent: name, max: 21)
            try self.validate(self.name, name: "name", parent: name, min: 1)
            try self.validate(self.name, name: "name", parent: name, pattern: "^[0-9a-z_\\-]+$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct GetCanaryResponse: AWSDecodableShape {
        /// A strucure that contains the full information about the canary.
        public let canary: Canary?

        public init(canary: Canary? = nil) {
            self.canary = canary
        }

        private enum CodingKeys: String, CodingKey {
            case canary = "Canary"
        }
    }

    public struct GetCanaryRunsRequest: AWSEncodableShape {
        public static var _encoding = [
            AWSMemberEncoding(label: "name", location: .uri(locationName: "name"))
        ]

        /// 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.
        public let maxResults: Int?
        /// The name of the canary that you want to see runs for.
        public let name: 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.
        public let nextToken: String?

        public init(maxResults: Int? = nil, name: String, nextToken: String? = nil) {
            self.maxResults = maxResults
            self.name = name
            self.nextToken = nextToken
        }

        public func validate(name: String) throws {
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 100)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
            try self.validate(self.name, name: "name", parent: name, max: 21)
            try self.validate(self.name, name: "name", parent: name, min: 1)
            try self.validate(self.name, name: "name", parent: name, pattern: "^[0-9a-z_\\-]+$")
            try self.validate(self.nextToken, name: "nextToken", parent: name, max: 252)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 4)
        }

        private enum CodingKeys: String, CodingKey {
            case maxResults = "MaxResults"
            case nextToken = "NextToken"
        }
    }

    public struct GetCanaryRunsResponse: AWSDecodableShape {
        /// An array of structures. Each structure contains the details of one of the retrieved canary runs.
        public let canaryRuns: [CanaryRun]?
        /// 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.
        public let nextToken: String?

        public init(canaryRuns: [CanaryRun]? = nil, nextToken: String? = nil) {
            self.canaryRuns = canaryRuns
            self.nextToken = nextToken
        }

        private enum CodingKeys: String, CodingKey {
            case canaryRuns = "CanaryRuns"
            case nextToken = "NextToken"
        }
    }

    public struct ListTagsForResourceRequest: AWSEncodableShape {
        public static var _encoding = [
            AWSMemberEncoding(label: "resourceArn", location: .uri(locationName: "resourceArn"))
        ]

        /// 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 .
        public let resourceArn: String

        public init(resourceArn: String) {
            self.resourceArn = resourceArn
        }

        public func validate(name: String) throws {
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, max: 2048)
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, min: 1)
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, pattern: "arn:(aws[a-zA-Z-]*)?:synthetics:[a-z]{2}((-gov)|(-iso(b?)))?-[a-z]+-\\d{1}:\\d{12}:canary:[0-9a-z_\\-]{1,21}")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct ListTagsForResourceResponse: AWSDecodableShape {
        /// The list of tag keys and values associated with the canary that you specified.
        public let tags: [String: String]?

        public init(tags: [String: String]? = nil) {
            self.tags = tags
        }

        private enum CodingKeys: String, CodingKey {
            case tags = "Tags"
        }
    }

    public struct RuntimeVersion: AWSDecodableShape {
        /// If this runtime version is deprecated, this value is the date of deprecation.
        public let deprecationDate: Date?
        /// A description of the runtime version, created by Amazon.
        public let description: String?
        /// The date that the runtime version was released.
        public let releaseDate: Date?
        /// The name of the runtime version. For a list of valid runtime versions, see  Canary Runtime Versions.
        public let versionName: String?

        public init(deprecationDate: Date? = nil, description: String? = nil, releaseDate: Date? = nil, versionName: String? = nil) {
            self.deprecationDate = deprecationDate
            self.description = description
            self.releaseDate = releaseDate
            self.versionName = versionName
        }

        private enum CodingKeys: String, CodingKey {
            case deprecationDate = "DeprecationDate"
            case description = "Description"
            case releaseDate = "ReleaseDate"
            case versionName = "VersionName"
        }
    }

    public struct StartCanaryRequest: AWSEncodableShape {
        public static var _encoding = [
            AWSMemberEncoding(label: "name", location: .uri(locationName: "name"))
        ]

        /// The name of the canary that you want to run. To find canary names, use DescribeCanaries.
        public let name: String

        public init(name: String) {
            self.name = name
        }

        public func validate(name: String) throws {
            try self.validate(self.name, name: "name", parent: name, max: 21)
            try self.validate(self.name, name: "name", parent: name, min: 1)
            try self.validate(self.name, name: "name", parent: name, pattern: "^[0-9a-z_\\-]+$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct StartCanaryResponse: AWSDecodableShape {
        public init() {}
    }

    public struct StopCanaryRequest: AWSEncodableShape {
        public static var _encoding = [
            AWSMemberEncoding(label: "name", location: .uri(locationName: "name"))
        ]

        /// The name of the canary that you want to stop. To find the names of your canaries, use DescribeCanaries.
        public let name: String

        public init(name: String) {
            self.name = name
        }

        public func validate(name: String) throws {
            try self.validate(self.name, name: "name", parent: name, max: 21)
            try self.validate(self.name, name: "name", parent: name, min: 1)
            try self.validate(self.name, name: "name", parent: name, pattern: "^[0-9a-z_\\-]+$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct StopCanaryResponse: AWSDecodableShape {
        public init() {}
    }

    public struct TagResourceRequest: AWSEncodableShape {
        public static var _encoding = [
            AWSMemberEncoding(label: "resourceArn", location: .uri(locationName: "resourceArn"))
        ]

        /// 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 .
        public let resourceArn: String
        /// The list of key-value pairs to associate with the canary.
        public let tags: [String: String]

        public init(resourceArn: String, tags: [String: String]) {
            self.resourceArn = resourceArn
            self.tags = tags
        }

        public func validate(name: String) throws {
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, max: 2048)
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, min: 1)
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, pattern: "arn:(aws[a-zA-Z-]*)?:synthetics:[a-z]{2}((-gov)|(-iso(b?)))?-[a-z]+-\\d{1}:\\d{12}:canary:[0-9a-z_\\-]{1,21}")
            try self.tags.forEach {
                try validate($0.key, name: "tags.key", parent: name, max: 128)
                try validate($0.key, name: "tags.key", parent: name, min: 1)
                try validate($0.key, name: "tags.key", parent: name, pattern: "^(?!aws:)[a-zA-Z+-=._:/]+$")
                try validate($0.value, name: "tags[\"\($0.key)\"]", parent: name, max: 256)
            }
        }

        private enum CodingKeys: String, CodingKey {
            case tags = "Tags"
        }
    }

    public struct TagResourceResponse: AWSDecodableShape {
        public init() {}
    }

    public struct UntagResourceRequest: AWSEncodableShape {
        public static var _encoding = [
            AWSMemberEncoding(label: "resourceArn", location: .uri(locationName: "resourceArn")),
            AWSMemberEncoding(label: "tagKeys", location: .querystring(locationName: "tagKeys"))
        ]

        /// 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 .
        public let resourceArn: String
        /// The list of tag keys to remove from the resource.
        public let tagKeys: [String]

        public init(resourceArn: String, tagKeys: [String]) {
            self.resourceArn = resourceArn
            self.tagKeys = tagKeys
        }

        public func validate(name: String) throws {
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, max: 2048)
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, min: 1)
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, pattern: "arn:(aws[a-zA-Z-]*)?:synthetics:[a-z]{2}((-gov)|(-iso(b?)))?-[a-z]+-\\d{1}:\\d{12}:canary:[0-9a-z_\\-]{1,21}")
            try self.tagKeys.forEach {
                try validate($0, name: "tagKeys[]", parent: name, max: 128)
                try validate($0, name: "tagKeys[]", parent: name, min: 1)
                try validate($0, name: "tagKeys[]", parent: name, pattern: "^(?!aws:)[a-zA-Z+-=._:/]+$")
            }
            try self.validate(self.tagKeys, name: "tagKeys", parent: name, max: 50)
            try self.validate(self.tagKeys, name: "tagKeys", parent: name, min: 1)
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct UntagResourceResponse: AWSDecodableShape {
        public init() {}
    }

    public struct UpdateCanaryRequest: AWSEncodableShape {
        public static var _encoding = [
            AWSMemberEncoding(label: "name", location: .uri(locationName: "name"))
        ]

        /// 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.
        public let code: CanaryCodeInput?
        /// 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
        public let executionRoleArn: String?
        /// The number of days to retain data about failed runs of this canary.
        public let failureRetentionPeriodInDays: Int?
        /// 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.
        public let name: String
        /// A structure that contains the timeout value that is used for each individual run of the canary.
        public let runConfig: CanaryRunConfigInput?
        /// 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.
        public let runtimeVersion: String?
        /// A structure that contains information about how often the canary is to run, and when these runs are to stop.
        public let schedule: CanaryScheduleInput?
        /// The number of days to retain data about successful runs of this canary.
        public let successRetentionPeriodInDays: Int?
        /// 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.
        public let vpcConfig: VpcConfigInput?

        public init(code: CanaryCodeInput? = nil, executionRoleArn: String? = nil, failureRetentionPeriodInDays: Int? = nil, name: String, runConfig: CanaryRunConfigInput? = nil, runtimeVersion: String? = nil, schedule: CanaryScheduleInput? = nil, successRetentionPeriodInDays: Int? = nil, vpcConfig: VpcConfigInput? = nil) {
            self.code = code
            self.executionRoleArn = executionRoleArn
            self.failureRetentionPeriodInDays = failureRetentionPeriodInDays
            self.name = name
            self.runConfig = runConfig
            self.runtimeVersion = runtimeVersion
            self.schedule = schedule
            self.successRetentionPeriodInDays = successRetentionPeriodInDays
            self.vpcConfig = vpcConfig
        }

        public func validate(name: String) throws {
            try self.code?.validate(name: "\(name).code")
            try self.validate(self.executionRoleArn, name: "executionRoleArn", parent: name, max: 2048)
            try self.validate(self.executionRoleArn, name: "executionRoleArn", parent: name, min: 1)
            try self.validate(self.executionRoleArn, name: "executionRoleArn", parent: name, pattern: "arn:(aws[a-zA-Z-]*)?:iam::\\d{12}:role/?[a-zA-Z_0-9+=,.@\\-_/]+")
            try self.validate(self.failureRetentionPeriodInDays, name: "failureRetentionPeriodInDays", parent: name, max: 1024)
            try self.validate(self.failureRetentionPeriodInDays, name: "failureRetentionPeriodInDays", parent: name, min: 1)
            try self.validate(self.name, name: "name", parent: name, max: 21)
            try self.validate(self.name, name: "name", parent: name, min: 1)
            try self.validate(self.name, name: "name", parent: name, pattern: "^[0-9a-z_\\-]+$")
            try self.runConfig?.validate(name: "\(name).runConfig")
            try self.validate(self.runtimeVersion, name: "runtimeVersion", parent: name, max: 1024)
            try self.validate(self.runtimeVersion, name: "runtimeVersion", parent: name, min: 1)
            try self.schedule?.validate(name: "\(name).schedule")
            try self.validate(self.successRetentionPeriodInDays, name: "successRetentionPeriodInDays", parent: name, max: 1024)
            try self.validate(self.successRetentionPeriodInDays, name: "successRetentionPeriodInDays", parent: name, min: 1)
            try self.vpcConfig?.validate(name: "\(name).vpcConfig")
        }

        private enum CodingKeys: String, CodingKey {
            case code = "Code"
            case executionRoleArn = "ExecutionRoleArn"
            case failureRetentionPeriodInDays = "FailureRetentionPeriodInDays"
            case runConfig = "RunConfig"
            case runtimeVersion = "RuntimeVersion"
            case schedule = "Schedule"
            case successRetentionPeriodInDays = "SuccessRetentionPeriodInDays"
            case vpcConfig = "VpcConfig"
        }
    }

    public struct UpdateCanaryResponse: AWSDecodableShape {
        public init() {}
    }

    public struct VpcConfigInput: AWSEncodableShape {
        /// The IDs of the security groups for this canary.
        public let securityGroupIds: [String]?
        /// The IDs of the subnets where this canary is to run.
        public let subnetIds: [String]?

        public init(securityGroupIds: [String]? = nil, subnetIds: [String]? = nil) {
            self.securityGroupIds = securityGroupIds
            self.subnetIds = subnetIds
        }

        public func validate(name: String) throws {
            try self.validate(self.securityGroupIds, name: "securityGroupIds", parent: name, max: 5)
            try self.validate(self.securityGroupIds, name: "securityGroupIds", parent: name, min: 0)
            try self.validate(self.subnetIds, name: "subnetIds", parent: name, max: 16)
            try self.validate(self.subnetIds, name: "subnetIds", parent: name, min: 0)
        }

        private enum CodingKeys: String, CodingKey {
            case securityGroupIds = "SecurityGroupIds"
            case subnetIds = "SubnetIds"
        }
    }

    public struct VpcConfigOutput: AWSDecodableShape {
        /// The IDs of the security groups for this canary.
        public let securityGroupIds: [String]?
        /// The IDs of the subnets where this canary is to run.
        public let subnetIds: [String]?
        /// The IDs of the VPC where this canary is to run.
        public let vpcId: String?

        public init(securityGroupIds: [String]? = nil, subnetIds: [String]? = nil, vpcId: String? = nil) {
            self.securityGroupIds = securityGroupIds
            self.subnetIds = subnetIds
            self.vpcId = vpcId
        }

        private enum CodingKeys: String, CodingKey {
            case securityGroupIds = "SecurityGroupIds"
            case subnetIds = "SubnetIds"
            case vpcId = "VpcId"
        }
    }
}
