{
  "typeName" : "AWS::QuickSight::Template",
  "description" : "Definition of the AWS::QuickSight::Template Resource Type.",
  "definitions" : {
    "ColumnGroupColumnSchema" : {
      "type" : "object",
      "description" : "<p>A structure describing the name, data type, and geographic role of the columns.</p>",
      "properties" : {
        "Name" : {
          "type" : "string",
          "description" : "<p>The name of the column group's column schema.</p>"
        }
      },
      "additionalProperties" : false
    },
    "ColumnGroupSchema" : {
      "type" : "object",
      "description" : "<p>The column group schema.</p>",
      "properties" : {
        "ColumnGroupColumnSchemaList" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/ColumnGroupColumnSchema"
          },
          "maxItems" : 500,
          "minItems" : 0,
          "description" : "<p>A structure containing the list of schemas for column group columns.</p>"
        },
        "Name" : {
          "type" : "string",
          "description" : "<p>The name of the column group schema.</p>"
        }
      },
      "additionalProperties" : false
    },
    "ColumnSchema" : {
      "type" : "object",
      "description" : "<p>The column schema.</p>",
      "properties" : {
        "DataType" : {
          "type" : "string",
          "description" : "<p>The data type of the column schema.</p>"
        },
        "GeographicRole" : {
          "type" : "string",
          "description" : "<p>The geographic role of the column schema.</p>"
        },
        "Name" : {
          "type" : "string",
          "description" : "<p>The name of the column schema.</p>"
        }
      },
      "additionalProperties" : false
    },
    "DataSetConfiguration" : {
      "type" : "object",
      "description" : "<p>Dataset configuration.</p>",
      "properties" : {
        "Placeholder" : {
          "type" : "string",
          "description" : "<p>Placeholder.</p>"
        },
        "DataSetSchema" : {
          "$ref" : "#/definitions/DataSetSchema"
        },
        "ColumnGroupSchemaList" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/ColumnGroupSchema"
          },
          "maxItems" : 500,
          "minItems" : 0,
          "description" : "<p>A structure containing the list of column group schemas.</p>"
        }
      },
      "additionalProperties" : false
    },
    "DataSetReference" : {
      "type" : "object",
      "description" : "<p>Dataset reference.</p>",
      "properties" : {
        "DataSetArn" : {
          "type" : "string",
          "description" : "<p>Dataset Amazon Resource Name (ARN).</p>"
        },
        "DataSetPlaceholder" : {
          "type" : "string",
          "pattern" : ".*\\S.*",
          "description" : "<p>Dataset placeholder.</p>"
        }
      },
      "required" : [ "DataSetArn", "DataSetPlaceholder" ],
      "additionalProperties" : false
    },
    "DataSetSchema" : {
      "type" : "object",
      "description" : "<p>Dataset schema.</p>",
      "properties" : {
        "ColumnSchemaList" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/ColumnSchema"
          },
          "maxItems" : 500,
          "minItems" : 0,
          "description" : "<p>A structure containing the list of column schemas.</p>"
        }
      },
      "additionalProperties" : false
    },
    "ResourcePermission" : {
      "type" : "object",
      "description" : "<p>Permission for the resource.</p>",
      "properties" : {
        "Actions" : {
          "type" : "array",
          "items" : {
            "type" : "string"
          },
          "maxItems" : 16,
          "minItems" : 1,
          "description" : "<p>The IAM action to grant or revoke permissions on.</p>"
        },
        "Principal" : {
          "type" : "string",
          "maxLength" : 256,
          "minLength" : 1,
          "description" : "<p>The Amazon Resource Name (ARN) of the principal. This can be one of the\n            following:</p>\n        <ul>\n            <li>\n                <p>The ARN of an Amazon QuickSight user or group associated with a data source or dataset. (This is common.)</p>\n            </li>\n            <li>\n                <p>The ARN of an Amazon QuickSight user, group, or namespace associated with an analysis, dashboard, template, or theme. (This is common.)</p>\n            </li>\n            <li>\n                <p>The ARN of an AWS account root: This is an IAM ARN rather than a QuickSight\n                    ARN. Use this option only to share resources (templates) across AWS accounts.\n                    (This is less common.) </p>\n            </li>\n         </ul>"
        }
      },
      "required" : [ "Actions", "Principal" ],
      "additionalProperties" : false
    },
    "ResourceStatus" : {
      "type" : "string",
      "enum" : [ "CREATION_IN_PROGRESS", "CREATION_SUCCESSFUL", "CREATION_FAILED", "UPDATE_IN_PROGRESS", "UPDATE_SUCCESSFUL", "UPDATE_FAILED", "DELETED" ]
    },
    "Sheet" : {
      "type" : "object",
      "description" : "<p>A <i>sheet</i>, which is an object that contains a set of visuals that\n            are viewed together on one page in the Amazon QuickSight console. Every analysis and dashboard\n            contains at least one sheet. Each sheet contains at least one visualization widget, for\n            example a chart, pivot table, or narrative insight. Sheets can be associated with other\n            components, such as controls, filters, and so on.</p>",
      "properties" : {
        "SheetId" : {
          "type" : "string",
          "maxLength" : 2048,
          "minLength" : 1,
          "pattern" : "[\\w\\-]+",
          "description" : "<p>The unique identifier associated with a sheet.</p>"
        },
        "Name" : {
          "type" : "string",
          "pattern" : ".*\\S.*",
          "description" : "<p>The name of a sheet. This name is displayed on the sheet's tab in the QuickSight\n            console.</p>"
        }
      },
      "additionalProperties" : false
    },
    "Tag" : {
      "type" : "object",
      "description" : "<p>The key or keys of the key-value pairs for the resource tag or tags assigned to the\n            resource.</p>",
      "properties" : {
        "Value" : {
          "type" : "string",
          "maxLength" : 256,
          "minLength" : 1,
          "description" : "<p>Tag value.</p>"
        },
        "Key" : {
          "type" : "string",
          "maxLength" : 128,
          "minLength" : 1,
          "description" : "<p>Tag key.</p>"
        }
      },
      "required" : [ "Key", "Value" ],
      "additionalProperties" : false
    },
    "TemplateError" : {
      "type" : "object",
      "description" : "<p>List of errors that occurred when the template version creation failed.</p>",
      "properties" : {
        "Type" : {
          "$ref" : "#/definitions/TemplateErrorType"
        },
        "Message" : {
          "type" : "string",
          "pattern" : ".*\\S.*",
          "description" : "<p>Description of the error type.</p>"
        }
      },
      "additionalProperties" : false
    },
    "TemplateErrorType" : {
      "type" : "string",
      "enum" : [ "SOURCE_NOT_FOUND", "DATA_SET_NOT_FOUND", "INTERNAL_FAILURE", "ACCESS_DENIED" ]
    },
    "TemplateSourceAnalysis" : {
      "type" : "object",
      "description" : "<p>The source analysis of the template.</p>",
      "properties" : {
        "DataSetReferences" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/DataSetReference"
          },
          "minItems" : 1,
          "description" : "<p>A structure containing information about the dataset references used as placeholders\n            in the template.</p>"
        },
        "Arn" : {
          "type" : "string",
          "description" : "<p>The Amazon Resource Name (ARN) of the resource.</p>"
        }
      },
      "required" : [ "Arn", "DataSetReferences" ],
      "additionalProperties" : false
    },
    "TemplateSourceEntity" : {
      "type" : "object",
      "description" : "<p>The source entity of the template.</p>",
      "properties" : {
        "SourceAnalysis" : {
          "$ref" : "#/definitions/TemplateSourceAnalysis"
        },
        "SourceTemplate" : {
          "$ref" : "#/definitions/TemplateSourceTemplate"
        }
      },
      "additionalProperties" : false
    },
    "TemplateSourceTemplate" : {
      "type" : "object",
      "description" : "<p>The source template of the template.</p>",
      "properties" : {
        "Arn" : {
          "type" : "string",
          "description" : "<p>The Amazon Resource Name (ARN) of the resource.</p>"
        }
      },
      "required" : [ "Arn" ],
      "additionalProperties" : false
    },
    "TemplateVersion" : {
      "type" : "object",
      "description" : "<p>A version of a template.</p>",
      "properties" : {
        "Status" : {
          "$ref" : "#/definitions/ResourceStatus"
        },
        "Errors" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/TemplateError"
          },
          "minItems" : 1,
          "description" : "<p>Errors associated with this template version.</p>"
        },
        "CreatedTime" : {
          "type" : "string",
          "description" : "<p>The time that this template version was created.</p>",
          "format" : "string"
        },
        "Description" : {
          "type" : "string",
          "maxLength" : 512,
          "minLength" : 1,
          "description" : "<p>The description of the template.</p>"
        },
        "ThemeArn" : {
          "type" : "string",
          "description" : "<p>The ARN of the theme associated with this version of the template.</p>"
        },
        "DataSetConfigurations" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/DataSetConfiguration"
          },
          "maxItems" : 30,
          "minItems" : 0,
          "description" : "<p>Schema of the dataset identified by the placeholder. Any dashboard created from this\n            template should be bound to new datasets matching the same schema described through this\n            API operation.</p>"
        },
        "SourceEntityArn" : {
          "type" : "string",
          "description" : "<p>The Amazon Resource Name (ARN) of an analysis or template that was used to create this\n            template.</p>"
        },
        "VersionNumber" : {
          "type" : "number",
          "minimum" : 1,
          "description" : "<p>The version number of the template version.</p>"
        },
        "Sheets" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/Sheet"
          },
          "maxItems" : 20,
          "minItems" : 0,
          "description" : "<p>A list of the associated sheets with the unique identifier and name of each sheet.</p>"
        }
      },
      "additionalProperties" : false
    }
  },
  "properties" : {
    "Arn" : {
      "type" : "string",
      "description" : "<p>The Amazon Resource Name (ARN) of the template.</p>"
    },
    "AwsAccountId" : {
      "type" : "string",
      "maxLength" : 12,
      "minLength" : 12,
      "pattern" : "^[0-9]{12}$"
    },
    "CreatedTime" : {
      "type" : "string",
      "description" : "<p>Time when this was created.</p>",
      "format" : "string"
    },
    "LastUpdatedTime" : {
      "type" : "string",
      "description" : "<p>Time when this was last updated.</p>",
      "format" : "string"
    },
    "Name" : {
      "type" : "string",
      "maxLength" : 2048,
      "minLength" : 1,
      "pattern" : "[\\u0020-\\u00FF]+",
      "description" : "<p>A display name for the template.</p>"
    },
    "Permissions" : {
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/ResourcePermission"
      },
      "maxItems" : 64,
      "minItems" : 1,
      "description" : "<p>A list of resource permissions to be set on the template. </p>"
    },
    "SourceEntity" : {
      "$ref" : "#/definitions/TemplateSourceEntity"
    },
    "Tags" : {
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/Tag"
      },
      "maxItems" : 200,
      "minItems" : 1,
      "description" : "<p>Contains a map of the key-value pairs for the resource tag or tags assigned to the resource.</p>"
    },
    "TemplateId" : {
      "type" : "string",
      "maxLength" : 2048,
      "minLength" : 1,
      "pattern" : "[\\w\\-]+"
    },
    "Version" : {
      "$ref" : "#/definitions/TemplateVersion"
    },
    "VersionDescription" : {
      "type" : "string",
      "maxLength" : 512,
      "minLength" : 1,
      "description" : "<p>A description of the current template version being created. This API operation creates the\n\t\t\tfirst version of the template. Every time <code>UpdateTemplate</code> is called, a new\n\t\t\tversion is created. Each version of the template maintains a description of the version\n\t\t\tin the <code>VersionDescription</code> field.</p>"
    }
  },
  "required" : [ "AwsAccountId", "TemplateId", "SourceEntity" ],
  "additionalProperties" : false,
  "readOnlyProperties" : [ "/properties/TemplateError", "/properties/CreatedTime", "/properties/Version", "/properties/LastUpdatedTime", "/properties/Arn" ],
  "writeOnlyProperties" : [ "/properties/VersionDescription", "/properties/SourceEntity", "/properties/CreatedTime", "/properties/Version", "/properties/LastUpdatedTime" ],
  "createOnlyProperties" : [ "/properties/AwsAccountId", "/properties/TemplateId" ],
  "primaryIdentifier" : [ "/properties/AwsAccountId", "/properties/TemplateId" ],
  "handlers" : {
    "read" : {
      "permissions" : [ "quicksight:DescribeTemplate" ]
    },
    "create" : {
      "permissions" : [ "quicksight:DescribeTemplate", "quicksight:DescribeTemplatePermissions", "quicksight:CreateTemplate", "quicksight:DescribeAnalysis", "quicksight:ListTagsForResource" ]
    },
    "list" : {
      "permissions" : [ "quicksight:ListTemplates" ]
    },
    "update" : {
      "permissions" : [ "quicksight:UpdateTemplate", "quicksight:UpdateTemplatePermissions", "quicksight:DescribeAnalysis", "quicksight:TagResource", "quicksight:UntagResource", "quicksight:ListTagsForResource" ]
    },
    "delete" : {
      "permissions" : [ "quicksight:DescribeTemplate", "quicksight:DeleteTemplate" ]
    }
  }
}