{
  "typeName" : "AWS::CleanRooms::AnalysisTemplate",
  "description" : "Represents a stored analysis within a collaboration",
  "definitions" : {
    "AnalysisParameter" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "DefaultValue" : {
          "type" : "string",
          "minLength" : 0,
          "maxLength" : 1000
        },
        "Name" : {
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 100,
          "pattern" : "[0-9a-zA-Z_]+"
        },
        "Type" : {
          "type" : "string",
          "enum" : [ "SMALLINT", "INTEGER", "BIGINT", "DECIMAL", "REAL", "DOUBLE_PRECISION", "BOOLEAN", "CHAR", "VARCHAR", "DATE", "TIMESTAMP", "TIMESTAMPTZ", "TIME", "TIMETZ", "VARBYTE", "BINARY", "BYTE", "CHARACTER", "DOUBLE", "FLOAT", "INT", "LONG", "NUMERIC", "SHORT", "STRING", "TIMESTAMP_LTZ", "TIMESTAMP_NTZ", "TINYINT" ]
        }
      },
      "required" : [ "Name", "Type" ]
    },
    "TableName" : {
      "type" : "string",
      "maxLength" : 128,
      "pattern" : "^[a-zA-Z0-9_](([a-zA-Z0-9_ ]+-)*([a-zA-Z0-9_ ]+))?$"
    },
    "ReferencedTables" : {
      "type" : "array",
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/TableName"
      },
      "minItems" : 0
    },
    "AnalysisSchema" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "ReferencedTables" : {
          "$ref" : "#/definitions/ReferencedTables"
        }
      },
      "required" : [ "ReferencedTables" ]
    },
    "AnalysisSource" : {
      "oneOf" : [ {
        "type" : "object",
        "title" : "Text",
        "properties" : {
          "Text" : {
            "type" : "string",
            "maxLength" : 90000,
            "minLength" : 0
          }
        },
        "required" : [ "Text" ],
        "additionalProperties" : false
      }, {
        "type" : "object",
        "title" : "Artifacts",
        "properties" : {
          "Artifacts" : {
            "$ref" : "#/definitions/AnalysisTemplateArtifacts"
          }
        },
        "required" : [ "Artifacts" ],
        "additionalProperties" : false
      } ]
    },
    "AnalysisTemplateArtifacts" : {
      "type" : "object",
      "properties" : {
        "EntryPoint" : {
          "$ref" : "#/definitions/AnalysisTemplateArtifact"
        },
        "AdditionalArtifacts" : {
          "type" : "array",
          "insertionOrder" : false,
          "items" : {
            "$ref" : "#/definitions/AnalysisTemplateArtifact"
          },
          "maxItems" : 1,
          "minItems" : 1
        },
        "RoleArn" : {
          "type" : "string",
          "maxLength" : 512,
          "minLength" : 32
        }
      },
      "required" : [ "EntryPoint", "RoleArn" ],
      "additionalProperties" : false
    },
    "AnalysisTemplateArtifact" : {
      "type" : "object",
      "properties" : {
        "Location" : {
          "$ref" : "#/definitions/S3Location"
        }
      },
      "required" : [ "Location" ],
      "additionalProperties" : false
    },
    "S3Location" : {
      "type" : "object",
      "properties" : {
        "Bucket" : {
          "type" : "string",
          "maxLength" : 63,
          "minLength" : 3
        },
        "Key" : {
          "type" : "string"
        }
      },
      "required" : [ "Bucket", "Key" ],
      "additionalProperties" : false
    },
    "AnalysisSourceMetadata" : {
      "oneOf" : [ {
        "type" : "object",
        "title" : "Artifacts",
        "properties" : {
          "Artifacts" : {
            "$ref" : "#/definitions/AnalysisTemplateArtifactMetadata"
          }
        },
        "required" : [ "Artifacts" ],
        "additionalProperties" : false
      } ]
    },
    "AnalysisTemplateArtifactMetadata" : {
      "type" : "object",
      "properties" : {
        "EntryPointHash" : {
          "$ref" : "#/definitions/Hash"
        },
        "AdditionalArtifactHashes" : {
          "type" : "array",
          "insertionOrder" : false,
          "items" : {
            "$ref" : "#/definitions/Hash"
          }
        }
      },
      "required" : [ "EntryPointHash" ],
      "additionalProperties" : false
    },
    "Hash" : {
      "type" : "object",
      "properties" : {
        "Sha256" : {
          "type" : "string"
        }
      },
      "additionalProperties" : false
    },
    "Tag" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Key" : {
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 128
        },
        "Value" : {
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 256
        }
      },
      "required" : [ "Value", "Key" ]
    },
    "ErrorMessageConfiguration" : {
      "type" : "object",
      "properties" : {
        "Type" : {
          "type" : "string",
          "enum" : [ "DETAILED" ]
        }
      },
      "required" : [ "Type" ],
      "additionalProperties" : false
    },
    "SyntheticDataParameters" : {
      "oneOf" : [ {
        "type" : "object",
        "title" : "MlSyntheticDataParameters",
        "properties" : {
          "MlSyntheticDataParameters" : {
            "$ref" : "#/definitions/MLSyntheticDataParameters"
          }
        },
        "required" : [ "MlSyntheticDataParameters" ],
        "additionalProperties" : false
      } ]
    },
    "MLSyntheticDataParameters" : {
      "type" : "object",
      "properties" : {
        "Epsilon" : {
          "type" : "number",
          "minimum" : 1.0E-4,
          "maximum" : 10
        },
        "MaxMembershipInferenceAttackScore" : {
          "type" : "number",
          "minimum" : 0.5,
          "maximum" : 1
        },
        "ColumnClassification" : {
          "$ref" : "#/definitions/ColumnClassificationDetails"
        }
      },
      "required" : [ "Epsilon", "MaxMembershipInferenceAttackScore", "ColumnClassification" ],
      "additionalProperties" : false
    },
    "ColumnClassificationDetails" : {
      "type" : "object",
      "properties" : {
        "ColumnMapping" : {
          "type" : "array",
          "insertionOrder" : false,
          "items" : {
            "$ref" : "#/definitions/SyntheticDataColumnProperties"
          },
          "minItems" : 5,
          "maxItems" : 1000
        }
      },
      "required" : [ "ColumnMapping" ],
      "additionalProperties" : false
    },
    "SyntheticDataColumnProperties" : {
      "type" : "object",
      "properties" : {
        "ColumnName" : {
          "type" : "string",
          "maxLength" : 128,
          "pattern" : "^[a-z0-9_](([a-z0-9_]+-)*([a-z0-9_]+))?$"
        },
        "ColumnType" : {
          "type" : "string",
          "enum" : [ "CATEGORICAL", "NUMERICAL" ]
        },
        "IsPredictiveValue" : {
          "type" : "boolean"
        }
      },
      "required" : [ "ColumnName", "ColumnType", "IsPredictiveValue" ],
      "additionalProperties" : false
    }
  },
  "properties" : {
    "Arn" : {
      "type" : "string",
      "maxLength" : 200
    },
    "CollaborationArn" : {
      "type" : "string",
      "maxLength" : 100
    },
    "CollaborationIdentifier" : {
      "type" : "string",
      "maxLength" : 36,
      "minLength" : 36,
      "pattern" : "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
    },
    "Tags" : {
      "description" : "An arbitrary set of tags (key-value pairs) for this cleanrooms analysis template.",
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/Tag"
      },
      "type" : "array"
    },
    "AnalysisParameters" : {
      "description" : "The member who can query can provide this placeholder for a literal data value in an analysis template",
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/AnalysisParameter"
      },
      "type" : "array",
      "minItems" : 0,
      "maxItems" : 50
    },
    "AnalysisTemplateIdentifier" : {
      "type" : "string",
      "maxLength" : 36,
      "minLength" : 36,
      "pattern" : "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
    },
    "Description" : {
      "type" : "string",
      "maxLength" : 255,
      "pattern" : "^[\\u0020-\\uD7FF\\uE000-\\uFFFD\\uD800\\uDBFF-\\uDC00\\uDFFF\\t\\r\\n]*$"
    },
    "MembershipArn" : {
      "type" : "string",
      "maxLength" : 100
    },
    "MembershipIdentifier" : {
      "type" : "string",
      "maxLength" : 36,
      "minLength" : 36,
      "pattern" : "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
    },
    "Name" : {
      "type" : "string",
      "maxLength" : 128,
      "pattern" : "^[a-zA-Z0-9_](([a-zA-Z0-9_ ]+-)*([a-zA-Z0-9_ ]+))?$"
    },
    "Schema" : {
      "$ref" : "#/definitions/AnalysisSchema"
    },
    "Source" : {
      "$ref" : "#/definitions/AnalysisSource"
    },
    "SourceMetadata" : {
      "$ref" : "#/definitions/AnalysisSourceMetadata"
    },
    "Format" : {
      "type" : "string",
      "enum" : [ "SQL", "PYSPARK_1_0" ]
    },
    "ErrorMessageConfiguration" : {
      "$ref" : "#/definitions/ErrorMessageConfiguration"
    },
    "SyntheticDataParameters" : {
      "$ref" : "#/definitions/SyntheticDataParameters"
    }
  },
  "required" : [ "Source", "Format", "Name", "MembershipIdentifier" ],
  "readOnlyProperties" : [ "/properties/CollaborationArn", "/properties/CollaborationIdentifier", "/properties/AnalysisTemplateIdentifier", "/properties/Arn", "/properties/MembershipArn" ],
  "createOnlyProperties" : [ "/properties/Name", "/properties/MembershipIdentifier", "/properties/Source", "/properties/Format", "/properties/AnalysisParameters", "/properties/Schema", "/properties/ErrorMessageConfiguration", "/properties/SyntheticDataParameters" ],
  "primaryIdentifier" : [ "/properties/AnalysisTemplateIdentifier", "/properties/MembershipIdentifier" ],
  "replacementStrategy" : "delete_then_create",
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "cloudFormationSystemTags" : true,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "cleanrooms:ListTagsForResource", "cleanrooms:UntagResource", "cleanrooms:TagResource" ]
  },
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-cleanrooms",
  "handlers" : {
    "create" : {
      "permissions" : [ "cleanrooms:CreateAnalysisTemplate", "cleanrooms:ListTagsForResource", "cleanrooms:TagResource", "cleanrooms:GetAnalysisTemplate", "cleanrooms:ListAnalysisTemplates", "iam:PassRole" ]
    },
    "read" : {
      "permissions" : [ "cleanrooms:GetAnalysisTemplate", "cleanrooms:ListTagsForResource" ]
    },
    "update" : {
      "permissions" : [ "cleanrooms:UpdateAnalysisTemplate", "cleanrooms:GetAnalysisTemplate", "cleanrooms:ListTagsForResource", "cleanrooms:TagResource", "cleanrooms:UntagResource" ]
    },
    "delete" : {
      "permissions" : [ "cleanrooms:DeleteAnalysisTemplate", "cleanrooms:GetAnalysisTemplate", "cleanrooms:ListAnalysisTemplates", "cleanrooms:ListTagsForResource", "cleanrooms:UntagResource" ]
    },
    "list" : {
      "permissions" : [ "cleanrooms:ListAnalysisTemplates" ],
      "handlerSchema" : {
        "properties" : {
          "MembershipIdentifier" : {
            "$ref" : "resource-schema.json#/properties/MembershipIdentifier"
          }
        },
        "required" : [ "MembershipIdentifier" ]
      }
    }
  },
  "additionalProperties" : false
}