{
  "$comment" : "Resource Schema for AWS::Athena::WorkGroup. Any changes made to SDK model for WorkGroup should be reflected here.",
  "typeName" : "AWS::Athena::WorkGroup",
  "description" : "Resource schema for AWS::Athena::WorkGroup",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-athena.git",
  "definitions" : {
    "Tags" : {
      "type" : "array",
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/Tag"
      }
    },
    "Tag" : {
      "type" : "object",
      "properties" : {
        "Key" : {
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 128
        },
        "Value" : {
          "type" : "string",
          "minLength" : 0,
          "maxLength" : 256
        }
      },
      "required" : [ "Key", "Value" ],
      "additionalProperties" : false
    },
    "SelectedEngineVersion" : {
      "description" : "The engine version requested by the user. Possible values are determined by the output of ListEngineVersions, including Auto. The default is Auto.",
      "type" : "string"
    },
    "EffectiveEngineVersion" : {
      "description" : "Read only. The engine version on which the query runs. If the user requests a valid engine version other than Auto, the effective engine version is the same as the engine version that the user requested. If the user requests Auto, the effective engine version is chosen by Athena. When a request to update the engine version is made by a CreateWorkGroup or UpdateWorkGroup operation, the EffectiveEngineVersion field is ignored.",
      "type" : "string"
    },
    "EngineVersion" : {
      "description" : "The Athena engine version for running queries.",
      "type" : "object",
      "properties" : {
        "SelectedEngineVersion" : {
          "$ref" : "#/definitions/SelectedEngineVersion"
        },
        "EffectiveEngineVersion" : {
          "$ref" : "#/definitions/EffectiveEngineVersion"
        }
      },
      "additionalProperties" : false
    },
    "BytesScannedCutoffPerQuery" : {
      "description" : "The upper data usage limit (cutoff) for the amount of bytes a single query in a workgroup is allowed to scan.",
      "type" : "integer",
      "format" : "int64",
      "minimum" : 10000000
    },
    "EnforceWorkGroupConfiguration" : {
      "description" : "If set to \"true\", the settings for the workgroup override client-side settings. If set to \"false\", client-side settings are used",
      "type" : "boolean"
    },
    "PublishCloudWatchMetricsEnabled" : {
      "description" : "Indicates that the Amazon CloudWatch metrics are enabled for the workgroup.",
      "type" : "boolean"
    },
    "RequesterPaysEnabled" : {
      "description" : "If set to true, allows members assigned to a workgroup to reference Amazon S3 Requester Pays buckets in queries. If set to false, workgroup members cannot query data from Requester Pays buckets, and queries that retrieve data from Requester Pays buckets cause an error. ",
      "type" : "boolean"
    },
    "OutputLocation" : {
      "description" : "The location in Amazon S3 where your query results are stored, such as s3://path/to/query/bucket/. To run the query, you must specify the query results location using one of the ways: either for individual queries using either this setting (client-side), or in the workgroup, using WorkGroupConfiguration",
      "type" : "string"
    },
    "KmsKey" : {
      "description" : "For SSE-KMS and CSE-KMS, this is the KMS key ARN or ID. ",
      "type" : "string"
    },
    "EncryptionOption" : {
      "description" : "Indicates whether Amazon S3 server-side encryption with Amazon S3-managed keys (SSE-S3), server-side encryption with KMS-managed keys (SSE-KMS), or client-side encryption with KMS-managed keys (CSE-KMS) is used.",
      "type" : "string",
      "enum" : [ "SSE_S3", "SSE_KMS", "CSE_KMS" ]
    },
    "RemoveBytesScannedCutoffPerQuery" : {
      "description" : "Indicates that the data usage control limit per query is removed.",
      "type" : "boolean"
    },
    "EncryptionConfiguration" : {
      "description" : "If query results are encrypted in Amazon S3, indicates the encryption option used (for example, SSE-KMS or CSE-KMS) and key information.",
      "type" : "object",
      "properties" : {
        "EncryptionOption" : {
          "$ref" : "#/definitions/EncryptionOption"
        },
        "KmsKey" : {
          "$ref" : "#/definitions/KmsKey"
        }
      },
      "required" : [ "EncryptionOption" ],
      "additionalProperties" : false
    },
    "ManagedStorageEncryptionConfiguration" : {
      "description" : "Indicates the encryption configuration for Athena Managed Storage. If not setting this field, Managed Storage will encrypt the query results with Athena's encryption key",
      "type" : "object",
      "properties" : {
        "KmsKey" : {
          "$ref" : "#/definitions/KmsKey"
        }
      },
      "additionalProperties" : false
    },
    "RemoveEncryptionConfiguration" : {
      "type" : "boolean"
    },
    "AdditionalConfiguration" : {
      "description" : "Additional Configuration that are passed to Athena Spark Calculations running in this workgroup",
      "type" : "string"
    },
    "ExecutionRole" : {
      "description" : "The ARN of the execution role used to access user resources for Spark sessions and Identity Center enabled workgroups. This property applies only to Spark enabled workgroups and Identity Center enabled workgroups.",
      "type" : "string"
    },
    "RemoveOutputLocation" : {
      "type" : "boolean"
    },
    "ExpectedBucketOwner" : {
      "description" : "The AWS account ID of the owner of S3 bucket where query results are stored",
      "type" : "string"
    },
    "RemoveExpectedBucketOwner" : {
      "type" : "boolean"
    },
    "S3AclOption" : {
      "description" : "The Amazon S3 canned ACL that Athena should specify when storing query results. Currently the only supported canned ACL is BUCKET_OWNER_FULL_CONTROL",
      "type" : "string",
      "enum" : [ "BUCKET_OWNER_FULL_CONTROL" ]
    },
    "AclConfiguration" : {
      "description" : "Indicates that an Amazon S3 canned ACL should be set to control ownership of stored query results",
      "type" : "object",
      "properties" : {
        "S3AclOption" : {
          "$ref" : "#/definitions/S3AclOption"
        }
      },
      "required" : [ "S3AclOption" ],
      "additionalProperties" : false
    },
    "RemoveAclConfiguration" : {
      "type" : "boolean"
    },
    "CustomerContentEncryptionConfiguration" : {
      "description" : "Indicates the KMS key for encrypting notebook content.",
      "type" : "object",
      "properties" : {
        "KmsKey" : {
          "$ref" : "#/definitions/KmsKey"
        }
      },
      "required" : [ "KmsKey" ],
      "additionalProperties" : false
    },
    "RemoveCustomerContentEncryptionConfiguration" : {
      "type" : "boolean"
    },
    "ResultConfiguration" : {
      "description" : "The location in Amazon S3 where query results are stored and the encryption option, if any, used for query results. These are known as \"client-side settings\". If workgroup settings override client-side settings, then the query uses the workgroup settings.\n",
      "type" : "object",
      "properties" : {
        "EncryptionConfiguration" : {
          "$ref" : "#/definitions/EncryptionConfiguration"
        },
        "OutputLocation" : {
          "$ref" : "#/definitions/OutputLocation"
        },
        "ExpectedBucketOwner" : {
          "$ref" : "#/definitions/ExpectedBucketOwner"
        },
        "AclConfiguration" : {
          "$ref" : "#/definitions/AclConfiguration"
        }
      },
      "additionalProperties" : false
    },
    "ResultConfigurationUpdates" : {
      "description" : "The result configuration information about the queries in this workgroup that will be updated. Includes the updated results location and an updated option for encrypting query results. ",
      "type" : "object",
      "properties" : {
        "EncryptionConfiguration" : {
          "$ref" : "#/definitions/EncryptionConfiguration"
        },
        "OutputLocation" : {
          "$ref" : "#/definitions/OutputLocation"
        },
        "ExpectedBucketOwner" : {
          "$ref" : "#/definitions/ExpectedBucketOwner"
        },
        "AclConfiguration" : {
          "$ref" : "#/definitions/AclConfiguration"
        },
        "RemoveEncryptionConfiguration" : {
          "$ref" : "#/definitions/RemoveEncryptionConfiguration"
        },
        "RemoveOutputLocation" : {
          "$ref" : "#/definitions/RemoveOutputLocation"
        },
        "RemoveExpectedBucketOwner" : {
          "$ref" : "#/definitions/RemoveExpectedBucketOwner"
        },
        "RemoveAclConfiguration" : {
          "$ref" : "#/definitions/RemoveAclConfiguration"
        }
      },
      "additionalProperties" : false
    },
    "ManagedQueryResultsConfiguration" : {
      "description" : "The configuration for the managed query results and encryption option. ResultConfiguration and ManagedQueryResultsConfiguration cannot be set at the same time",
      "type" : "object",
      "properties" : {
        "EncryptionConfiguration" : {
          "$ref" : "#/definitions/ManagedStorageEncryptionConfiguration"
        },
        "Enabled" : {
          "type" : "boolean"
        }
      },
      "additionalProperties" : false
    },
    "Classification" : {
      "description" : "A classification refers to a set of specific configurations.",
      "type" : "object",
      "properties" : {
        "Name" : {
          "type" : "string",
          "description" : "The name of the configuration classification."
        },
        "Properties" : {
          "type" : "object",
          "description" : "A set of properties specified within a configuration classification.",
          "patternProperties" : {
            "^.+$" : {
              "type" : "string"
            }
          },
          "additionalProperties" : false
        }
      },
      "additionalProperties" : false
    },
    "EngineConfiguration" : {
      "description" : "The engine configuration for running queries.",
      "type" : "object",
      "properties" : {
        "CoordinatorDpuSize" : {
          "type" : "integer",
          "description" : "The number of DPUs to use for the coordinator. A coordinator is a special executor that orchestrates processing work and manages other executors in a notebook session. The default is 1."
        },
        "MaxConcurrentDpus" : {
          "type" : "integer",
          "description" : "The maximum number of DPUs that can run concurrently."
        },
        "DefaultExecutorDpuSize" : {
          "type" : "integer",
          "description" : "The default number of DPUs to use for executors. An executor is the smallest unit of compute that a notebook session can request from Athena. The default is 1."
        },
        "AdditionalConfigs" : {
          "type" : "object",
          "description" : "Contains additional notebook engine MAP<string, string> parameter mappings in the form of key-value pairs. To specify an Athena notebook that the Jupyter server will download and serve, specify a value for the StartSessionRequest$NotebookVersion field, and then add a key named NotebookId to AdditionalConfigs that has the value of the Athena notebook ID.",
          "patternProperties" : {
            "^.+$" : {
              "type" : "string"
            }
          },
          "additionalProperties" : false
        },
        "SparkProperties" : {
          "type" : "object",
          "description" : "Specifies custom jar files and Spark properties for use cases like cluster encryption, table formats, and general Spark tuning.",
          "patternProperties" : {
            "^.+$" : {
              "type" : "string"
            }
          },
          "additionalProperties" : false
        },
        "Classifications" : {
          "type" : "array",
          "description" : "The configuration classifications that can be specified for the engine.",
          "items" : {
            "$ref" : "#/definitions/Classification"
          }
        }
      },
      "additionalProperties" : false
    },
    "CloudWatchLoggingConfiguration" : {
      "description" : "Configuration settings for delivering logs to Amazon CloudWatch log groups.",
      "type" : "object",
      "properties" : {
        "Enabled" : {
          "type" : "boolean",
          "description" : "Enables CloudWatch logging."
        },
        "LogGroup" : {
          "type" : "string",
          "description" : "The name of the log group in Amazon CloudWatch Logs where you want to publish your logs."
        },
        "LogStreamNamePrefix" : {
          "type" : "string",
          "description" : "Prefix for the CloudWatch log stream name."
        },
        "LogTypes" : {
          "type" : "object",
          "description" : "The types of logs that you want to publish to CloudWatch.",
          "patternProperties" : {
            "^.+$" : {
              "type" : "array",
              "items" : {
                "type" : "string"
              }
            }
          },
          "additionalProperties" : false
        }
      },
      "additionalProperties" : false
    },
    "ManagedLoggingConfiguration" : {
      "description" : "Configuration settings for managed log persistence.",
      "type" : "object",
      "properties" : {
        "Enabled" : {
          "type" : "boolean",
          "description" : "Enables managed log persistence."
        },
        "KmsKey" : {
          "type" : "string",
          "description" : "The KMS key ARN to encrypt the logs stored in managed log persistence."
        }
      },
      "additionalProperties" : false
    },
    "S3LoggingConfiguration" : {
      "description" : "Configuration settings for delivering logs to Amazon S3 buckets.",
      "type" : "object",
      "properties" : {
        "Enabled" : {
          "type" : "boolean",
          "description" : "Enables S3 log delivery."
        },
        "LogLocation" : {
          "type" : "string",
          "description" : "The Amazon S3 destination URI for log publishing."
        },
        "KmsKey" : {
          "type" : "string",
          "description" : "The KMS key ARN to encrypt the logs published to the given Amazon S3 destination."
        }
      },
      "additionalProperties" : false
    },
    "MonitoringConfiguration" : {
      "description" : "Contains the configuration settings for managed log persistence, delivering logs to Amazon S3 buckets, Amazon CloudWatch log groups etc.",
      "type" : "object",
      "properties" : {
        "CloudWatchLoggingConfiguration" : {
          "$ref" : "#/definitions/CloudWatchLoggingConfiguration"
        },
        "ManagedLoggingConfiguration" : {
          "$ref" : "#/definitions/ManagedLoggingConfiguration"
        },
        "S3LoggingConfiguration" : {
          "$ref" : "#/definitions/S3LoggingConfiguration"
        }
      },
      "additionalProperties" : false
    },
    "WorkGroupConfiguration" : {
      "type" : "object",
      "properties" : {
        "BytesScannedCutoffPerQuery" : {
          "$ref" : "#/definitions/BytesScannedCutoffPerQuery"
        },
        "EnforceWorkGroupConfiguration" : {
          "$ref" : "#/definitions/EnforceWorkGroupConfiguration"
        },
        "PublishCloudWatchMetricsEnabled" : {
          "$ref" : "#/definitions/PublishCloudWatchMetricsEnabled"
        },
        "RequesterPaysEnabled" : {
          "$ref" : "#/definitions/RequesterPaysEnabled"
        },
        "ResultConfiguration" : {
          "$ref" : "#/definitions/ResultConfiguration"
        },
        "EngineVersion" : {
          "$ref" : "#/definitions/EngineVersion"
        },
        "AdditionalConfiguration" : {
          "$ref" : "#/definitions/AdditionalConfiguration"
        },
        "ExecutionRole" : {
          "$ref" : "#/definitions/ExecutionRole"
        },
        "CustomerContentEncryptionConfiguration" : {
          "$ref" : "#/definitions/CustomerContentEncryptionConfiguration"
        },
        "ManagedQueryResultsConfiguration" : {
          "$ref" : "#/definitions/ManagedQueryResultsConfiguration"
        },
        "EngineConfiguration" : {
          "$ref" : "#/definitions/EngineConfiguration"
        },
        "MonitoringConfiguration" : {
          "$ref" : "#/definitions/MonitoringConfiguration"
        }
      },
      "additionalProperties" : false
    },
    "WorkGroupConfigurationUpdates" : {
      "type" : "object",
      "description" : "The configuration information that will be updated for this workgroup, which includes the location in Amazon S3 where query results are stored, the encryption option, if any, used for query results, whether the Amazon CloudWatch Metrics are enabled for the workgroup, whether the workgroup settings override the client-side settings, and the data usage limit for the amount of bytes scanned per query, if it is specified. ",
      "properties" : {
        "BytesScannedCutoffPerQuery" : {
          "$ref" : "#/definitions/BytesScannedCutoffPerQuery"
        },
        "EnforceWorkGroupConfiguration" : {
          "$ref" : "#/definitions/EnforceWorkGroupConfiguration"
        },
        "PublishCloudWatchMetricsEnabled" : {
          "$ref" : "#/definitions/PublishCloudWatchMetricsEnabled"
        },
        "RequesterPaysEnabled" : {
          "$ref" : "#/definitions/RequesterPaysEnabled"
        },
        "ResultConfigurationUpdates" : {
          "$ref" : "#/definitions/ResultConfigurationUpdates"
        },
        "RemoveBytesScannedCutoffPerQuery" : {
          "$ref" : "#/definitions/RemoveBytesScannedCutoffPerQuery"
        },
        "EngineVersion" : {
          "$ref" : "#/definitions/EngineVersion"
        },
        "AdditionalConfiguration" : {
          "$ref" : "#/definitions/AdditionalConfiguration"
        },
        "ExecutionRole" : {
          "$ref" : "#/definitions/ExecutionRole"
        },
        "CustomerContentEncryptionConfiguration" : {
          "$ref" : "#/definitions/CustomerContentEncryptionConfiguration"
        },
        "RemoveCustomerContentEncryptionConfiguration" : {
          "$ref" : "#/definitions/RemoveCustomerContentEncryptionConfiguration"
        },
        "ManagedQueryResultsConfiguration" : {
          "$ref" : "#/definitions/ManagedQueryResultsConfiguration"
        },
        "EngineConfiguration" : {
          "$ref" : "#/definitions/EngineConfiguration"
        },
        "MonitoringConfiguration" : {
          "$ref" : "#/definitions/MonitoringConfiguration"
        }
      },
      "additionalProperties" : false
    }
  },
  "properties" : {
    "Name" : {
      "description" : "The workGroup name.",
      "pattern" : "[a-zA-Z0-9._-]{1,128}",
      "type" : "string"
    },
    "Description" : {
      "description" : "The workgroup description.",
      "type" : "string",
      "minLength" : 0,
      "maxLength" : 1024
    },
    "Tags" : {
      "description" : "One or more tags, separated by commas, that you want to attach to the workgroup as you create it",
      "$ref" : "#/definitions/Tags"
    },
    "WorkGroupConfiguration" : {
      "description" : "The workgroup configuration",
      "$ref" : "#/definitions/WorkGroupConfiguration"
    },
    "WorkGroupConfigurationUpdates" : {
      "description" : "The workgroup configuration update object",
      "$ref" : "#/definitions/WorkGroupConfigurationUpdates"
    },
    "CreationTime" : {
      "description" : "The date and time the workgroup was created.",
      "type" : "string"
    },
    "State" : {
      "description" : "The state of the workgroup: ENABLED or DISABLED.",
      "type" : "string",
      "enum" : [ "ENABLED", "DISABLED" ]
    },
    "RecursiveDeleteOption" : {
      "description" : "The option to delete the workgroup and its contents even if the workgroup contains any named queries.",
      "type" : "boolean"
    }
  },
  "required" : [ "Name" ],
  "handlers" : {
    "create" : {
      "permissions" : [ "athena:CreateWorkGroup", "athena:TagResource", "iam:PassRole", "s3:GetBucketLocation", "s3:GetObject", "s3:ListBucket", "s3:ListBucketMultipartUploads", "s3:AbortMultipartUpload", "s3:PutObject", "s3:ListMultipartUploadParts", "kms:Decrypt", "kms:GenerateDataKey" ]
    },
    "read" : {
      "permissions" : [ "athena:GetWorkGroup", "athena:ListTagsForResource" ]
    },
    "list" : {
      "permissions" : [ "athena:ListWorkGroups" ]
    },
    "delete" : {
      "permissions" : [ "athena:DeleteWorkGroup", "athena:GetWorkGroup", "athena:UntagResource" ]
    },
    "update" : {
      "permissions" : [ "athena:UpdateWorkGroup", "athena:TagResource", "athena:UntagResource", "iam:PassRole", "s3:GetBucketLocation", "s3:GetObject", "s3:ListBucket", "s3:ListBucketMultipartUploads", "s3:AbortMultipartUpload", "s3:PutObject", "s3:ListMultipartUploadParts", "kms:Decrypt", "kms:GenerateDataKey" ]
    }
  },
  "readOnlyProperties" : [ "/properties/CreationTime", "/properties/WorkGroupConfiguration/EngineVersion/EffectiveEngineVersion", "/properties/WorkGroupConfigurationUpdates/EngineVersion/EffectiveEngineVersion" ],
  "createOnlyProperties" : [ "/properties/Name" ],
  "deprecatedProperties" : [ "/properties/WorkGroupConfigurationUpdates" ],
  "writeOnlyProperties" : [ "/properties/WorkGroupConfigurationUpdates", "/properties/RecursiveDeleteOption", "/properties/WorkGroupConfiguration/AdditionalConfiguration" ],
  "primaryIdentifier" : [ "/properties/Name" ],
  "additionalProperties" : false,
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "cloudFormationSystemTags" : true,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "athena:UntagResource", "athena:TagResource", "athena:ListTagsForResource" ]
  }
}