{
  "typeName" : "AWS::SageMaker::DataQualityJobDefinition",
  "description" : "Resource Type definition for AWS::SageMaker::DataQualityJobDefinition",
  "additionalProperties" : false,
  "properties" : {
    "JobDefinitionArn" : {
      "description" : "The Amazon Resource Name (ARN) of job definition.",
      "type" : "string",
      "minLength" : 1,
      "maxLength" : 256
    },
    "JobDefinitionName" : {
      "$ref" : "#/definitions/JobDefinitionName"
    },
    "DataQualityBaselineConfig" : {
      "$ref" : "#/definitions/DataQualityBaselineConfig"
    },
    "DataQualityAppSpecification" : {
      "$ref" : "#/definitions/DataQualityAppSpecification"
    },
    "DataQualityJobInput" : {
      "$ref" : "#/definitions/DataQualityJobInput"
    },
    "DataQualityJobOutputConfig" : {
      "$ref" : "#/definitions/MonitoringOutputConfig"
    },
    "JobResources" : {
      "$ref" : "#/definitions/MonitoringResources"
    },
    "NetworkConfig" : {
      "$ref" : "#/definitions/NetworkConfig"
    },
    "EndpointName" : {
      "$ref" : "#/definitions/EndpointName"
    },
    "RoleArn" : {
      "description" : "The Amazon Resource Name (ARN) of an IAM role that Amazon SageMaker can assume to perform tasks on your behalf.",
      "type" : "string",
      "pattern" : "^arn:aws[a-z\\-]*:iam::\\d{12}:role/?[a-zA-Z_0-9+=,.@\\-_/]+$",
      "minLength" : 20,
      "maxLength" : 2048
    },
    "StoppingCondition" : {
      "$ref" : "#/definitions/StoppingCondition"
    },
    "Tags" : {
      "type" : "array",
      "maxItems" : 50,
      "description" : "An array of key-value pairs to apply to this resource.",
      "items" : {
        "$ref" : "#/definitions/Tag"
      }
    },
    "CreationTime" : {
      "description" : "The time at which the job definition was created.",
      "type" : "string"
    }
  },
  "definitions" : {
    "DataQualityBaselineConfig" : {
      "type" : "object",
      "additionalProperties" : false,
      "description" : "Baseline configuration used to validate that the data conforms to the specified constraints and statistics.",
      "properties" : {
        "BaseliningJobName" : {
          "$ref" : "#/definitions/ProcessingJobName"
        },
        "ConstraintsResource" : {
          "$ref" : "#/definitions/ConstraintsResource"
        },
        "StatisticsResource" : {
          "$ref" : "#/definitions/StatisticsResource"
        }
      }
    },
    "ConstraintsResource" : {
      "type" : "object",
      "additionalProperties" : false,
      "description" : "The baseline constraints resource for a monitoring job.",
      "properties" : {
        "S3Uri" : {
          "description" : "The Amazon S3 URI for baseline constraint file in Amazon S3 that the current monitoring job should validated against.",
          "$ref" : "#/definitions/S3Uri"
        }
      }
    },
    "StatisticsResource" : {
      "type" : "object",
      "additionalProperties" : false,
      "description" : "The baseline statistics resource for a monitoring job.",
      "properties" : {
        "S3Uri" : {
          "description" : "The Amazon S3 URI for the baseline statistics file in Amazon S3 that the current monitoring job should be validated against.",
          "$ref" : "#/definitions/S3Uri"
        }
      }
    },
    "S3Uri" : {
      "type" : "string",
      "description" : "The Amazon S3 URI.",
      "pattern" : "^(https|s3)://([^/]+)/?(.*)$",
      "maxLength" : 1024
    },
    "DataQualityAppSpecification" : {
      "type" : "object",
      "additionalProperties" : false,
      "description" : "Container image configuration object for the monitoring job.",
      "properties" : {
        "ContainerArguments" : {
          "type" : "array",
          "description" : "An array of arguments for the container used to run the monitoring job.",
          "maxItems" : 50,
          "items" : {
            "type" : "string",
            "minLength" : 1,
            "maxLength" : 256
          }
        },
        "ContainerEntrypoint" : {
          "type" : "array",
          "description" : "Specifies the entrypoint for a container used to run the monitoring job.",
          "maxItems" : 100,
          "items" : {
            "type" : "string",
            "minLength" : 1,
            "maxLength" : 256
          }
        },
        "ImageUri" : {
          "type" : "string",
          "description" : "The container image to be run by the monitoring job.",
          "pattern" : ".*",
          "maxLength" : 255
        },
        "PostAnalyticsProcessorSourceUri" : {
          "description" : "An Amazon S3 URI to a script that is called after analysis has been performed. Applicable only for the built-in (first party) containers.",
          "$ref" : "#/definitions/S3Uri"
        },
        "RecordPreprocessorSourceUri" : {
          "description" : "An Amazon S3 URI to a script that is called per row prior to running analysis. It can base64 decode the payload and convert it into a flatted json so that the built-in container can use the converted data. Applicable only for the built-in (first party) containers",
          "$ref" : "#/definitions/S3Uri"
        },
        "Environment" : {
          "type" : "object",
          "additionalProperties" : false,
          "description" : "Sets the environment variables in the Docker container",
          "patternProperties" : {
            "[a-zA-Z_][a-zA-Z0-9_]*" : {
              "type" : "string",
              "minLength" : 1,
              "maxLength" : 256
            },
            "[\\S\\s]*" : {
              "type" : "string",
              "maxLength" : 256
            }
          }
        }
      },
      "required" : [ "ImageUri" ]
    },
    "DataQualityJobInput" : {
      "type" : "object",
      "additionalProperties" : false,
      "description" : "The inputs for a monitoring job.",
      "properties" : {
        "EndpointInput" : {
          "$ref" : "#/definitions/EndpointInput"
        },
        "BatchTransformInput" : {
          "$ref" : "#/definitions/BatchTransformInput"
        }
      }
    },
    "EndpointInput" : {
      "type" : "object",
      "additionalProperties" : false,
      "description" : "The endpoint for a monitoring job.",
      "properties" : {
        "EndpointName" : {
          "$ref" : "#/definitions/EndpointName"
        },
        "LocalPath" : {
          "type" : "string",
          "description" : "Path to the filesystem where the endpoint data is available to the container.",
          "pattern" : ".*",
          "maxLength" : 256
        },
        "S3DataDistributionType" : {
          "type" : "string",
          "description" : "Whether input data distributed in Amazon S3 is fully replicated or sharded by an S3 key. Defauts to FullyReplicated",
          "enum" : [ "FullyReplicated", "ShardedByS3Key" ]
        },
        "S3InputMode" : {
          "type" : "string",
          "description" : "Whether the Pipe or File is used as the input mode for transfering data for the monitoring job. Pipe mode is recommended for large datasets. File mode is useful for small files that fit in memory. Defaults to File.",
          "enum" : [ "Pipe", "File" ]
        },
        "ExcludeFeaturesAttribute" : {
          "type" : "string",
          "description" : "Indexes or names of the features to be excluded from analysis",
          "maxLength" : 100
        }
      },
      "required" : [ "EndpointName", "LocalPath" ]
    },
    "BatchTransformInput" : {
      "type" : "object",
      "additionalProperties" : false,
      "description" : "The batch transform input for a monitoring job.",
      "properties" : {
        "DataCapturedDestinationS3Uri" : {
          "type" : "string",
          "description" : "A URI that identifies the Amazon S3 storage location where Batch Transform Job captures data.",
          "pattern" : "^(https|s3)://([^/]+)/?(.*)$",
          "maxLength" : 512
        },
        "DatasetFormat" : {
          "$ref" : "#/definitions/DatasetFormat"
        },
        "LocalPath" : {
          "type" : "string",
          "description" : "Path to the filesystem where the endpoint data is available to the container.",
          "pattern" : ".*",
          "maxLength" : 256
        },
        "S3DataDistributionType" : {
          "type" : "string",
          "description" : "Whether input data distributed in Amazon S3 is fully replicated or sharded by an S3 key. Defauts to FullyReplicated",
          "enum" : [ "FullyReplicated", "ShardedByS3Key" ]
        },
        "S3InputMode" : {
          "type" : "string",
          "description" : "Whether the Pipe or File is used as the input mode for transfering data for the monitoring job. Pipe mode is recommended for large datasets. File mode is useful for small files that fit in memory. Defaults to File.",
          "enum" : [ "Pipe", "File" ]
        },
        "ExcludeFeaturesAttribute" : {
          "type" : "string",
          "description" : "Indexes or names of the features to be excluded from analysis",
          "maxLength" : 100
        }
      },
      "required" : [ "DataCapturedDestinationS3Uri", "DatasetFormat", "LocalPath" ]
    },
    "MonitoringOutputConfig" : {
      "type" : "object",
      "additionalProperties" : false,
      "description" : "The output configuration for monitoring jobs.",
      "properties" : {
        "KmsKeyId" : {
          "type" : "string",
          "description" : "The AWS Key Management Service (AWS KMS) key that Amazon SageMaker uses to encrypt the model artifacts at rest using Amazon S3 server-side encryption.",
          "pattern" : ".*",
          "maxLength" : 2048
        },
        "MonitoringOutputs" : {
          "type" : "array",
          "description" : "Monitoring outputs for monitoring jobs. This is where the output of the periodic monitoring jobs is uploaded.",
          "minLength" : 1,
          "maxLength" : 1,
          "items" : {
            "$ref" : "#/definitions/MonitoringOutput"
          }
        }
      },
      "required" : [ "MonitoringOutputs" ]
    },
    "MonitoringOutput" : {
      "type" : "object",
      "additionalProperties" : false,
      "description" : "The output object for a monitoring job.",
      "properties" : {
        "S3Output" : {
          "$ref" : "#/definitions/S3Output"
        }
      },
      "required" : [ "S3Output" ]
    },
    "S3Output" : {
      "type" : "object",
      "additionalProperties" : false,
      "description" : "Information about where and how to store the results of a monitoring job.",
      "properties" : {
        "LocalPath" : {
          "type" : "string",
          "description" : "The local path to the Amazon S3 storage location where Amazon SageMaker saves the results of a monitoring job. LocalPath is an absolute path for the output data.",
          "pattern" : ".*",
          "maxLength" : 256
        },
        "S3UploadMode" : {
          "type" : "string",
          "description" : "Whether to upload the results of the monitoring job continuously or after the job completes.",
          "enum" : [ "Continuous", "EndOfJob" ]
        },
        "S3Uri" : {
          "type" : "string",
          "description" : "A URI that identifies the Amazon S3 storage location where Amazon SageMaker saves the results of a monitoring job.",
          "pattern" : "^(https|s3)://([^/]+)/?(.*)$",
          "maxLength" : 512
        }
      },
      "required" : [ "LocalPath", "S3Uri" ]
    },
    "MonitoringResources" : {
      "type" : "object",
      "additionalProperties" : false,
      "description" : "Identifies the resources to deploy for a monitoring job.",
      "properties" : {
        "ClusterConfig" : {
          "$ref" : "#/definitions/ClusterConfig"
        }
      },
      "required" : [ "ClusterConfig" ]
    },
    "ClusterConfig" : {
      "type" : "object",
      "additionalProperties" : false,
      "description" : "Configuration for the cluster used to run model monitoring jobs.",
      "properties" : {
        "InstanceCount" : {
          "description" : "The number of ML compute instances to use in the model monitoring job. For distributed processing jobs, specify a value greater than 1. The default value is 1.",
          "type" : "integer",
          "minimum" : 1,
          "maximum" : 100
        },
        "InstanceType" : {
          "description" : "The ML compute instance type for the processing job.",
          "type" : "string"
        },
        "VolumeKmsKeyId" : {
          "description" : "The AWS Key Management Service (AWS KMS) key that Amazon SageMaker uses to encrypt data on the storage volume attached to the ML compute instance(s) that run the model monitoring job.",
          "type" : "string",
          "minimum" : 1,
          "maximum" : 2048
        },
        "VolumeSizeInGB" : {
          "description" : "The size of the ML storage volume, in gigabytes, that you want to provision. You must specify sufficient ML storage for your scenario.",
          "type" : "integer",
          "minimum" : 1,
          "maximum" : 16384
        }
      },
      "required" : [ "InstanceCount", "InstanceType", "VolumeSizeInGB" ]
    },
    "NetworkConfig" : {
      "type" : "object",
      "additionalProperties" : false,
      "description" : "Networking options for a job, such as network traffic encryption between containers, whether to allow inbound and outbound network calls to and from containers, and the VPC subnets and security groups to use for VPC-enabled jobs.",
      "properties" : {
        "EnableInterContainerTrafficEncryption" : {
          "description" : "Whether to encrypt all communications between distributed processing jobs. Choose True to encrypt communications. Encryption provides greater security for distributed processing jobs, but the processing might take longer.",
          "type" : "boolean"
        },
        "EnableNetworkIsolation" : {
          "description" : "Whether to allow inbound and outbound network calls to and from the containers used for the processing job.",
          "type" : "boolean"
        },
        "VpcConfig" : {
          "$ref" : "#/definitions/VpcConfig"
        }
      }
    },
    "VpcConfig" : {
      "type" : "object",
      "additionalProperties" : false,
      "description" : "Specifies a VPC that your training jobs and hosted models have access to. Control access to and from your training and model containers by configuring the VPC.",
      "properties" : {
        "SecurityGroupIds" : {
          "description" : "The VPC security group IDs, in the form sg-xxxxxxxx. Specify the security groups for the VPC that is specified in the Subnets field.",
          "type" : "array",
          "minItems" : 1,
          "maxItems" : 5,
          "items" : {
            "type" : "string",
            "maxLength" : 32,
            "pattern" : "[-0-9a-zA-Z]+"
          }
        },
        "Subnets" : {
          "description" : "The ID of the subnets in the VPC to which you want to connect to your monitoring jobs.",
          "type" : "array",
          "minItems" : 1,
          "maxItems" : 16,
          "items" : {
            "type" : "string",
            "maxLength" : 32,
            "pattern" : "[-0-9a-zA-Z]+"
          }
        }
      },
      "required" : [ "SecurityGroupIds", "Subnets" ]
    },
    "StoppingCondition" : {
      "type" : "object",
      "additionalProperties" : false,
      "description" : "Specifies a time limit for how long the monitoring job is allowed to run.",
      "properties" : {
        "MaxRuntimeInSeconds" : {
          "description" : "The maximum runtime allowed in seconds.",
          "type" : "integer",
          "minimum" : 1,
          "maximum" : 86400
        }
      },
      "required" : [ "MaxRuntimeInSeconds" ]
    },
    "Tag" : {
      "description" : "A key-value pair to associate with a resource.",
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Key" : {
          "type" : "string",
          "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 -. ",
          "minLength" : 1,
          "maxLength" : 128,
          "pattern" : "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]*)$"
        },
        "Value" : {
          "type" : "string",
          "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 -. ",
          "maxLength" : 256,
          "pattern" : "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]*)$"
        }
      },
      "required" : [ "Key", "Value" ]
    },
    "EndpointName" : {
      "type" : "string",
      "description" : "The name of the endpoint used to run the monitoring job.",
      "pattern" : "^[a-zA-Z0-9](-*[a-zA-Z0-9])*",
      "maxLength" : 63
    },
    "JobDefinitionName" : {
      "type" : "string",
      "description" : "The name of the job definition.",
      "pattern" : "^[a-zA-Z0-9](-*[a-zA-Z0-9])*$",
      "maxLength" : 63
    },
    "ProcessingJobName" : {
      "type" : "string",
      "description" : "The name of a processing job",
      "pattern" : "^[a-zA-Z0-9](-*[a-zA-Z0-9])*$",
      "minLength" : 1,
      "maxLength" : 63
    },
    "DatasetFormat" : {
      "description" : "The dataset format of the data to monitor",
      "type" : "object",
      "properties" : {
        "Csv" : {
          "$ref" : "#/definitions/Csv"
        },
        "Json" : {
          "$ref" : "#/definitions/Json"
        },
        "Parquet" : {
          "$ref" : "#/definitions/Parquet"
        }
      }
    },
    "Csv" : {
      "description" : "The CSV format",
      "type" : "object",
      "properties" : {
        "Header" : {
          "description" : "A boolean flag indicating if given CSV has header",
          "type" : "boolean"
        }
      }
    },
    "Json" : {
      "description" : "The Json format",
      "type" : "object",
      "properties" : {
        "Line" : {
          "description" : "A boolean flag indicating if it is JSON line format",
          "type" : "boolean"
        }
      }
    },
    "Parquet" : {
      "description" : "A flag indicate if the dataset format is Parquet",
      "type" : "boolean"
    }
  },
  "required" : [ "DataQualityAppSpecification", "DataQualityJobInput", "DataQualityJobOutputConfig", "JobResources", "RoleArn" ],
  "primaryIdentifier" : [ "/properties/JobDefinitionArn" ],
  "handlers" : {
    "create" : {
      "permissions" : [ "sagemaker:CreateDataQualityJobDefinition", "sagemaker:DescribeDataQualityJobDefinition", "sagemaker:AddTags", "sagemaker:ListTags", "iam:PassRole" ]
    },
    "delete" : {
      "permissions" : [ "sagemaker:DeleteDataQualityJobDefinition" ]
    },
    "read" : {
      "permissions" : [ "sagemaker:DescribeDataQualityJobDefinition", "sagemaker:ListTags" ]
    },
    "list" : {
      "permissions" : [ "sagemaker:ListDataQualityJobDefinitions", "sagemaker:ListTags" ]
    }
  },
  "readOnlyProperties" : [ "/properties/CreationTime", "/properties/JobDefinitionArn" ],
  "createOnlyProperties" : [ "/properties/JobDefinitionName", "/properties/DataQualityAppSpecification", "/properties/DataQualityBaselineConfig", "/properties/DataQualityJobInput", "/properties/DataQualityJobOutputConfig", "/properties/JobResources", "/properties/NetworkConfig", "/properties/RoleArn", "/properties/StoppingCondition", "/properties/Tags", "/properties/EndpointName" ],
  "writeOnlyProperties" : [ "/properties/EndpointName" ],
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : false,
    "cloudFormationSystemTags" : true,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "sagemaker:AddTags", "sagemaker:ListTags" ]
  }
}