{
  "typeName" : "AWS::Glue::Catalog",
  "description" : "Creates a catalog in the Glue Data Catalog.",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-glue",
  "definitions" : {
    "Tag" : {
      "type" : "object",
      "properties" : {
        "Key" : {
          "type" : "string",
          "description" : "The key name of the tag.",
          "minLength" : 1,
          "maxLength" : 128
        },
        "Value" : {
          "type" : "string",
          "description" : "The value for the tag.",
          "minLength" : 0,
          "maxLength" : 256
        }
      },
      "required" : [ "Key", "Value" ],
      "additionalProperties" : false
    },
    "FederatedCatalog" : {
      "type" : "object",
      "description" : "A FederatedCatalog structure that references an entity outside the Glue Data Catalog.",
      "properties" : {
        "Identifier" : {
          "type" : "string",
          "description" : "A unique identifier for the federated catalog."
        },
        "ConnectionName" : {
          "type" : "string",
          "description" : "The name of the connection to an external data source."
        }
      },
      "additionalProperties" : false
    },
    "TargetRedshiftCatalog" : {
      "type" : "object",
      "description" : "A structure that describes a target catalog for resource linking.",
      "properties" : {
        "CatalogArn" : {
          "type" : "string",
          "description" : "The Amazon Resource Name (ARN) of the catalog resource."
        }
      },
      "required" : [ "CatalogArn" ],
      "additionalProperties" : false
    },
    "DataLakePrincipal" : {
      "type" : "object",
      "description" : "The Lake Formation principal.",
      "properties" : {
        "DataLakePrincipalIdentifier" : {
          "type" : "string",
          "description" : "An identifier for the Lake Formation principal.",
          "minLength" : 1,
          "maxLength" : 255
        }
      },
      "additionalProperties" : false
    },
    "PrincipalPermissions" : {
      "type" : "object",
      "description" : "Permissions granted to a principal.",
      "properties" : {
        "Principal" : {
          "$ref" : "#/definitions/DataLakePrincipal"
        },
        "Permissions" : {
          "type" : "array",
          "description" : "The permissions that are granted to the principal.",
          "items" : {
            "type" : "string",
            "enum" : [ "ALL", "SELECT", "ALTER", "DROP", "DELETE", "INSERT", "CREATE_DATABASE", "CREATE_TABLE", "DATA_LOCATION_ACCESS" ]
          }
        }
      },
      "additionalProperties" : false
    },
    "CatalogProperties" : {
      "type" : "object",
      "description" : "A structure that specifies data lake access properties and other custom properties.",
      "properties" : {
        "DataLakeAccessProperties" : {
          "$ref" : "#/definitions/DataLakeAccessProperties"
        },
        "CustomProperties" : {
          "type" : "object",
          "description" : "Additional key-value properties for the catalog.",
          "patternProperties" : {
            "^.+$" : {
              "type" : "string"
            }
          },
          "additionalProperties" : false
        }
      },
      "additionalProperties" : false
    },
    "DataLakeAccessProperties" : {
      "type" : "object",
      "description" : "Data lake access properties for the catalog.",
      "properties" : {
        "DataLakeAccess" : {
          "type" : "boolean",
          "description" : "Turns on or off data lake access for Apache Spark applications that access Amazon Redshift databases in the Data Catalog from any non-Redshift engine."
        },
        "DataTransferRole" : {
          "type" : "string",
          "description" : "A role that will be assumed by Glue for transferring data into/out of the staging bucket during a query."
        },
        "KmsKey" : {
          "type" : "string",
          "description" : "An encryption key that will be used for the staging bucket that will be created along with the catalog."
        },
        "CatalogType" : {
          "type" : "string",
          "description" : "Specifies a federated catalog type for the native catalog resource."
        },
        "ManagedWorkgroupName" : {
          "type" : "string",
          "description" : "The name of the managed workgroup associated with the catalog."
        },
        "ManagedWorkgroupStatus" : {
          "type" : "string",
          "description" : "The status of the managed workgroup."
        },
        "RedshiftDatabaseName" : {
          "type" : "string",
          "description" : "The name of the Redshift database."
        },
        "AllowFullTableExternalDataAccess" : {
          "type" : "string",
          "description" : "Allows third-party engines to access data in Amazon S3 locations that are registered with Lake Formation.",
          "enum" : [ "True", "False" ]
        }
      },
      "additionalProperties" : false
    }
  },
  "properties" : {
    "CatalogId" : {
      "type" : "string",
      "description" : "The ID of the catalog."
    },
    "ResourceArn" : {
      "type" : "string",
      "description" : "The Amazon Resource Name (ARN) of the catalog."
    },
    "CreateTime" : {
      "type" : "integer",
      "description" : "The time at which the catalog was created."
    },
    "UpdateTime" : {
      "type" : "integer",
      "description" : "The time at which the catalog was last updated."
    },
    "Name" : {
      "type" : "string",
      "description" : "The name of the catalog to create.",
      "minLength" : 1,
      "maxLength" : 255
    },
    "Description" : {
      "type" : "string",
      "description" : "A description of the catalog.",
      "maxLength" : 2048
    },
    "Parameters" : {
      "type" : "object",
      "description" : "A map of key-value pairs that define parameters and properties of the catalog.",
      "patternProperties" : {
        "^.+$" : {
          "type" : "string"
        }
      },
      "additionalProperties" : false
    },
    "FederatedCatalog" : {
      "$ref" : "#/definitions/FederatedCatalog"
    },
    "TargetRedshiftCatalog" : {
      "$ref" : "#/definitions/TargetRedshiftCatalog"
    },
    "CatalogProperties" : {
      "$ref" : "#/definitions/CatalogProperties"
    },
    "CreateTableDefaultPermissions" : {
      "type" : "array",
      "description" : "An array of PrincipalPermissions objects for default table permissions.",
      "items" : {
        "$ref" : "#/definitions/PrincipalPermissions"
      }
    },
    "CreateDatabaseDefaultPermissions" : {
      "type" : "array",
      "description" : "An array of PrincipalPermissions objects for default database permissions.",
      "items" : {
        "$ref" : "#/definitions/PrincipalPermissions"
      }
    },
    "AllowFullTableExternalDataAccess" : {
      "type" : "string",
      "description" : "Allows third-party engines to access data in Amazon S3 locations that are registered with Lake Formation.",
      "enum" : [ "True", "False" ]
    },
    "OverwriteChildResourcePermissionsWithDefault" : {
      "type" : "string",
      "description" : "Specifies whether to overwrite child resource permissions with the default permissions.",
      "enum" : [ "Accept", "Deny" ]
    },
    "Tags" : {
      "type" : "array",
      "description" : "An array of key-value pairs to apply to this resource.",
      "uniqueItems" : true,
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/Tag"
      }
    }
  },
  "additionalProperties" : false,
  "required" : [ "Name" ],
  "createOnlyProperties" : [ "/properties/Name" ],
  "readOnlyProperties" : [ "/properties/CatalogId", "/properties/ResourceArn", "/properties/CreateTime", "/properties/UpdateTime", "/properties/CatalogProperties/DataLakeAccessProperties/ManagedWorkgroupName", "/properties/CatalogProperties/DataLakeAccessProperties/ManagedWorkgroupStatus", "/properties/CatalogProperties/DataLakeAccessProperties/RedshiftDatabaseName", "/properties/CatalogProperties/CustomProperties", "/properties/CreateDatabaseDefaultPermissions/*/Principal", "/properties/CreateDatabaseDefaultPermissions/*/Principal/DataLakePrincipalIdentifier", "/properties/CreateDatabaseDefaultPermissions/*/Permissions", "/properties/CreateTableDefaultPermissions/*/Principal", "/properties/CreateTableDefaultPermissions/*/Principal/DataLakePrincipalIdentifier", "/properties/CreateTableDefaultPermissions/*/Permissions" ],
  "primaryIdentifier" : [ "/properties/ResourceArn" ],
  "writeOnlyProperties" : [ "/properties/CatalogProperties/DataLakeAccessProperties/AllowFullTableExternalDataAccess", "/properties/OverwriteChildResourcePermissionsWithDefault" ],
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "cloudFormationSystemTags" : false,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "glue:TagResource", "glue:UntagResource", "glue:GetTags" ]
  },
  "handlers" : {
    "create" : {
      "permissions" : [ "glue:CreateCatalog", "glue:GetCatalog", "glue:UpdateCatalog", "glue:TagResource", "glue:GetTags", "iam:PassRole", "redshift-serverless:CreateNamespace", "redshift-serverless:GetNamespace", "redshift-serverless:CreateWorkgroup", "redshift-serverless:GetWorkgroup", "redshift-serverless:TagResource", "lakeformation:GetDataLakeSettings", "lakeformation:PutDataLakeSettings", "lakeformation:RegisterResource", "lakeformation:GrantPermissions", "s3:CreateBucket", "s3:DeleteBucket", "s3:PutBucketTagging", "s3:PutBucketPolicy", "s3:PutEncryptionConfiguration", "s3:PutLifecycleConfiguration", "s3:PutBucketVersioning", "s3:GetBucketLocation" ]
    },
    "read" : {
      "permissions" : [ "glue:GetCatalog", "glue:GetTags" ]
    },
    "update" : {
      "permissions" : [ "glue:UpdateCatalog", "glue:GetCatalog", "glue:TagResource", "glue:UntagResource", "glue:GetTags", "iam:PassRole", "redshift-serverless:UpdateNamespace", "redshift-serverless:GetNamespace", "redshift-serverless:UpdateWorkgroup", "redshift-serverless:GetWorkgroup", "redshift-serverless:TagResource", "redshift-serverless:UntagResource", "lakeformation:GetDataLakeSettings", "lakeformation:PutDataLakeSettings" ]
    },
    "delete" : {
      "permissions" : [ "glue:DeleteCatalog", "glue:GetCatalog", "redshift-serverless:DeleteNamespace", "redshift-serverless:GetNamespace", "redshift-serverless:DeleteWorkgroup", "redshift-serverless:GetWorkgroup", "lakeformation:DeregisterResource", "lakeformation:RevokePermissions", "s3:DeleteBucket" ]
    },
    "list" : {
      "permissions" : [ "glue:GetCatalogs" ]
    }
  }
}