{
  "typeName" : "AWS::RedshiftServerless::Workgroup",
  "description" : "Definition of AWS::RedshiftServerless::Workgroup Resource Type",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-redshift-serverless",
  "definitions" : {
    "ConfigParameter" : {
      "type" : "object",
      "properties" : {
        "ParameterKey" : {
          "type" : "string",
          "maxLength" : 255,
          "minLength" : 0
        },
        "ParameterValue" : {
          "type" : "string",
          "maxLength" : 15000,
          "minLength" : 0
        }
      },
      "additionalProperties" : false
    },
    "Endpoint" : {
      "type" : "object",
      "properties" : {
        "Address" : {
          "type" : "string"
        },
        "Port" : {
          "type" : "integer"
        },
        "VpcEndpoints" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/VpcEndpoint"
          },
          "insertionOrder" : false
        }
      },
      "additionalProperties" : false
    },
    "NetworkInterface" : {
      "type" : "object",
      "properties" : {
        "NetworkInterfaceId" : {
          "type" : "string"
        },
        "SubnetId" : {
          "type" : "string"
        },
        "PrivateIpAddress" : {
          "type" : "string"
        },
        "AvailabilityZone" : {
          "type" : "string"
        }
      },
      "additionalProperties" : false
    },
    "PerformanceTarget" : {
      "type" : "object",
      "properties" : {
        "Status" : {
          "$ref" : "#/definitions/PerformanceTargetStatus"
        },
        "Level" : {
          "type" : "integer",
          "minimum" : 1,
          "maximum" : 100
        }
      },
      "additionalProperties" : false
    },
    "VpcEndpoint" : {
      "type" : "object",
      "properties" : {
        "VpcEndpointId" : {
          "type" : "string"
        },
        "VpcId" : {
          "type" : "string"
        },
        "NetworkInterfaces" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/NetworkInterface"
          },
          "insertionOrder" : false
        }
      },
      "additionalProperties" : false
    },
    "Workgroup" : {
      "type" : "object",
      "properties" : {
        "WorkgroupId" : {
          "type" : "string"
        },
        "WorkgroupArn" : {
          "type" : "string"
        },
        "WorkgroupName" : {
          "type" : "string",
          "pattern" : "^[a-z0-9-]*$",
          "maxLength" : 64,
          "minLength" : 3
        },
        "NamespaceName" : {
          "type" : "string",
          "pattern" : "^[a-z0-9-]+$",
          "maxLength" : 64,
          "minLength" : 3
        },
        "BaseCapacity" : {
          "type" : "integer"
        },
        "MaxCapacity" : {
          "type" : "integer"
        },
        "EnhancedVpcRouting" : {
          "type" : "boolean"
        },
        "ConfigParameters" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/ConfigParameter"
          },
          "uniqueItems" : true,
          "insertionOrder" : false
        },
        "SecurityGroupIds" : {
          "type" : "array",
          "items" : {
            "type" : "string",
            "pattern" : "^sg-[0-9a-fA-F]{8,}$",
            "maxLength" : 255,
            "minLength" : 0
          },
          "insertionOrder" : false
        },
        "SubnetIds" : {
          "type" : "array",
          "items" : {
            "type" : "string",
            "pattern" : "^subnet-[0-9a-fA-F]{8,}$",
            "maxLength" : 255,
            "minLength" : 0
          },
          "insertionOrder" : false
        },
        "Status" : {
          "$ref" : "#/definitions/WorkgroupStatus"
        },
        "Endpoint" : {
          "$ref" : "#/definitions/Endpoint"
        },
        "PubliclyAccessible" : {
          "type" : "boolean"
        },
        "CreationDate" : {
          "type" : "string"
        },
        "PricePerformanceTarget" : {
          "$ref" : "#/definitions/PerformanceTarget"
        },
        "TrackName" : {
          "type" : "string",
          "maxLength" : 256,
          "minLength" : 1,
          "pattern" : "^[a-zA-Z0-9_]+$"
        }
      },
      "additionalProperties" : false
    },
    "Tag" : {
      "type" : "object",
      "properties" : {
        "Key" : {
          "type" : "string",
          "maxLength" : 128,
          "minLength" : 1
        },
        "Value" : {
          "type" : "string",
          "maxLength" : 256,
          "minLength" : 0
        }
      },
      "required" : [ "Key", "Value" ],
      "additionalProperties" : false
    },
    "WorkgroupStatus" : {
      "type" : "string",
      "enum" : [ "CREATING", "AVAILABLE", "MODIFYING", "DELETING" ]
    },
    "PerformanceTargetStatus" : {
      "type" : "string",
      "enum" : [ "ENABLED", "DISABLED" ]
    }
  },
  "properties" : {
    "WorkgroupName" : {
      "description" : "The name of the workgroup.",
      "type" : "string",
      "pattern" : "^(?=^[a-z0-9-]+$).{3,64}$",
      "maxLength" : 64,
      "minLength" : 3
    },
    "NamespaceName" : {
      "description" : "The namespace the workgroup is associated with.",
      "type" : "string",
      "pattern" : "^(?=^[a-z0-9-]+$).{3,64}$",
      "maxLength" : 64,
      "minLength" : 3
    },
    "BaseCapacity" : {
      "description" : "The base compute capacity of the workgroup in Redshift Processing Units (RPUs).",
      "type" : "integer"
    },
    "MaxCapacity" : {
      "description" : "The max compute capacity of the workgroup in Redshift Processing Units (RPUs).",
      "type" : "integer"
    },
    "EnhancedVpcRouting" : {
      "description" : "The value that specifies whether to enable enhanced virtual private cloud (VPC) routing, which forces Amazon Redshift Serverless to route traffic through your VPC.",
      "type" : "boolean",
      "default" : false
    },
    "ConfigParameters" : {
      "description" : "A list of parameters to set for finer control over a database. Available options are datestyle, enable_user_activity_logging, query_group, search_path, max_query_execution_time, and require_ssl.",
      "type" : "array",
      "uniqueItems" : true,
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/ConfigParameter"
      },
      "minItems" : 1
    },
    "SecurityGroupIds" : {
      "description" : "A list of security group IDs to associate with the workgroup.",
      "type" : "array",
      "insertionOrder" : false,
      "items" : {
        "type" : "string",
        "pattern" : "^sg-[0-9a-fA-F]{8,}$",
        "maxLength" : 255,
        "minLength" : 0
      },
      "maxItems" : 32,
      "minItems" : 1
    },
    "SubnetIds" : {
      "description" : "A list of subnet IDs the workgroup is associated with.",
      "type" : "array",
      "insertionOrder" : false,
      "items" : {
        "type" : "string",
        "pattern" : "^subnet-[0-9a-fA-F]{8,}$",
        "maxLength" : 255,
        "minLength" : 0
      },
      "maxItems" : 32,
      "minItems" : 1
    },
    "PubliclyAccessible" : {
      "description" : "A value that specifies whether the workgroup can be accessible from a public network.",
      "type" : "boolean",
      "default" : false
    },
    "Port" : {
      "description" : "The custom port to use when connecting to a workgroup. Valid port ranges are 5431-5455 and 8191-8215. The default is 5439.",
      "type" : "integer"
    },
    "PricePerformanceTarget" : {
      "description" : "A property that represents the price performance target settings for the workgroup.",
      "type" : "object",
      "$ref" : "#/definitions/PerformanceTarget"
    },
    "SnapshotArn" : {
      "description" : "The Amazon Resource Name (ARN) of the snapshot to restore from.",
      "type" : "string"
    },
    "SnapshotName" : {
      "description" : "The snapshot name to restore from.",
      "type" : "string"
    },
    "SnapshotOwnerAccount" : {
      "description" : "The Amazon Web Services account that owns the snapshot.",
      "type" : "string"
    },
    "RecoveryPointId" : {
      "description" : "The recovery point id to restore from.",
      "type" : "string"
    },
    "Tags" : {
      "description" : "The map of the key-value pairs used to tag the workgroup.",
      "type" : "array",
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/Tag"
      },
      "maxItems" : 200,
      "minItems" : 0
    },
    "TrackName" : {
      "type" : "string",
      "maxLength" : 256,
      "minLength" : 1,
      "pattern" : "^[a-zA-Z0-9_]+$"
    },
    "Workgroup" : {
      "description" : "Definition for workgroup resource",
      "$ref" : "#/definitions/Workgroup"
    }
  },
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "cloudFormationSystemTags" : true,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "redshift-serverless:ListTagsForResource", "redshift-serverless:TagResource", "redshift-serverless:UntagResource" ]
  },
  "additionalProperties" : false,
  "required" : [ "WorkgroupName" ],
  "createOnlyProperties" : [ "/properties/WorkgroupName", "/properties/NamespaceName" ],
  "readOnlyProperties" : [ "/properties/Workgroup/WorkgroupId", "/properties/Workgroup/WorkgroupArn", "/properties/Workgroup/WorkgroupName", "/properties/Workgroup/NamespaceName", "/properties/Workgroup/BaseCapacity", "/properties/Workgroup/MaxCapacity", "/properties/Workgroup/EnhancedVpcRouting", "/properties/Workgroup/ConfigParameters", "/properties/Workgroup/SecurityGroupIds", "/properties/Workgroup/SubnetIds", "/properties/Workgroup/TrackName", "/properties/Workgroup/Status", "/properties/Workgroup/Endpoint/Address", "/properties/Workgroup/Endpoint/Port", "/properties/Workgroup/Endpoint/VpcEndpoints/*/VpcEndpointId", "/properties/Workgroup/Endpoint/VpcEndpoints/*/VpcId", "/properties/Workgroup/Endpoint/VpcEndpoints/*/NetworkInterfaces/*/NetworkInterfaceId", "/properties/Workgroup/Endpoint/VpcEndpoints/*/NetworkInterfaces/*/SubnetId", "/properties/Workgroup/Endpoint/VpcEndpoints/*/NetworkInterfaces/*/PrivateIpAddress", "/properties/Workgroup/Endpoint/VpcEndpoints/*/NetworkInterfaces/*/AvailabilityZone", "/properties/Workgroup/PubliclyAccessible", "/properties/Workgroup/CreationDate" ],
  "writeOnlyProperties" : [ "/properties/ConfigParameters", "/properties/SecurityGroupIds", "/properties/SubnetIds", "/properties/SnapshotArn", "/properties/SnapshotName", "/properties/SnapshotOwnerAccount", "/properties/RecoveryPointId" ],
  "primaryIdentifier" : [ "/properties/WorkgroupName" ],
  "handlers" : {
    "create" : {
      "permissions" : [ "ec2:DescribeVpcAttribute", "ec2:DescribeSecurityGroups", "ec2:DescribeAddresses", "ec2:DescribeInternetGateways", "ec2:DescribeSubnets", "ec2:DescribeAccountAttributes", "ec2:DescribeAvailabilityZones", "redshift-serverless:CreateNamespace", "redshift-serverless:CreateWorkgroup", "redshift-serverless:GetWorkgroup", "redshift-serverless:GetNamespace", "redshift-serverless:ListTagsForResource", "redshift-serverless:TagResource", "redshift-serverless:RestoreFromSnapshot", "redshift-serverless:RestoreFromRecoveryPoint" ]
    },
    "read" : {
      "permissions" : [ "ec2:DescribeVpcAttribute", "ec2:DescribeSecurityGroups", "ec2:DescribeAddresses", "ec2:DescribeInternetGateways", "ec2:DescribeSubnets", "ec2:DescribeAccountAttributes", "ec2:DescribeAvailabilityZones", "redshift-serverless:GetWorkgroup", "redshift-serverless:ListTagsForResource" ]
    },
    "update" : {
      "permissions" : [ "ec2:DescribeVpcAttribute", "ec2:DescribeSecurityGroups", "ec2:DescribeAddresses", "ec2:DescribeInternetGateways", "ec2:DescribeSubnets", "ec2:DescribeAccountAttributes", "ec2:DescribeAvailabilityZones", "redshift-serverless:ListTagsForResource", "redshift-serverless:TagResource", "redshift-serverless:UntagResource", "redshift-serverless:GetWorkgroup", "redshift-serverless:UpdateWorkgroup", "redshift-serverless:ListTagsForResource", "redshift-serverless:TagResource", "redshift-serverless:UntagResource", "redshift-serverless:RestoreFromSnapshot", "redshift-serverless:RestoreFromRecoveryPoint" ]
    },
    "delete" : {
      "permissions" : [ "ec2:DescribeVpcAttribute", "ec2:DescribeSecurityGroups", "ec2:DescribeAddresses", "ec2:DescribeInternetGateways", "ec2:DescribeSubnets", "ec2:DescribeAccountAttributes", "ec2:DescribeAvailabilityZones", "redshift-serverless:GetWorkgroup", "redshift-serverless:GetNamespace", "redshift-serverless:DeleteWorkgroup", "redshift-serverless:ListTagsForResource", "redshift-serverless:UntagResource" ]
    },
    "list" : {
      "permissions" : [ "ec2:DescribeVpcAttribute", "ec2:DescribeSecurityGroups", "ec2:DescribeAddresses", "ec2:DescribeInternetGateways", "ec2:DescribeSubnets", "ec2:DescribeAccountAttributes", "ec2:DescribeAvailabilityZones", "redshift-serverless:ListWorkgroups", "redshift-serverless:ListTagsForResource" ]
    }
  }
}