Skip to content

create_template

create_template(
    aws_account_id: AwsAccountId,
    template_id: ShortRestrictiveResourceId,
    *,
    config_overrides: Optional[QuickSightClientConfig] = None,
    name: Optional[TemplateName] = None,
    permissions: Optional[ResourcePermissionList] = None,
    source_entity: Optional[TemplateSourceEntity] = None,
    tags: Optional[TagList] = None,
    version_description: Optional[VersionDescription] = None,
    definition: Optional[TemplateVersionDefinition] = None,
    validation_strategy: Optional[ValidationStrategy] = None,
) -> CreateTemplateResponse

Creates a template either from a TemplateDefinition or from an existing Quick Sight analysis or template. You can use the resulting template to create additional dashboards, templates, or analyses.

A template is an entity in Quick Sight that encapsulates the metadata required to create an analysis and that you can use to create s dashboard. A template adds a layer of abstraction by using placeholders to replace the dataset associated with the analysis. You can use templates to create dashboards by replacing dataset placeholders with datasets that follow the same schema that was used to create the source analysis and template.

Parameters:

  • aws_account_id (AwsAccountId) –

    The ID for the Amazon Web Services account that the group is in. You use the ID for the Amazon Web Services account that contains your Amazon Quick Sight account.

  • template_id (ShortRestrictiveResourceId) –

    An ID for the template that you want to create. This template is unique per Amazon Web Services Region; in each Amazon Web Services account.

  • name (Optional[TemplateName], default: None ) –

    A display name for the template.

  • permissions (Optional[ResourcePermissionList], default: None ) –

    A list of resource permissions to be set on the template.

  • source_entity (Optional[TemplateSourceEntity], default: None ) –

    The entity that you are using as a source when you create the template. In SourceEntity, you specify the type of object you're using as source: SourceTemplate for a template or SourceAnalysis for an analysis. Both of these require an Amazon Resource Name (ARN). For SourceTemplate, specify the ARN of the source template. For SourceAnalysis, specify the ARN of the source analysis. The SourceTemplate ARN can contain any Amazon Web Services account and any Quick Sight-supported Amazon Web Services Region.

    Use the DataSetReferences entity within SourceTemplate or SourceAnalysis to list the replacement datasets for the placeholders listed in the original. The schema in each dataset must match its placeholder. Use the TopicReferences entity to list the replacement topics for the topic placeholders listed in the original. The schema in each topic must match its placeholder.

    Either a SourceEntity or a Definition must be provided in order for the request to be valid.

  • tags (Optional[TagList], default: None ) –

    Contains a map of the key-value pairs for the resource tag or tags assigned to the resource.

  • version_description (Optional[VersionDescription], default: None ) –

    A description of the current template version being created. This API operation creates the first version of the template. Every time UpdateTemplate is called, a new version is created. Each version of the template maintains a description of the version in the VersionDescription field.

  • definition (Optional[TemplateVersionDefinition], default: None ) –

    The definition of a template.

    A definition is the data model of all features in a Dashboard, Template, or Analysis.

    Either a SourceEntity or a Definition must be provided in order for the request to be valid.

  • validation_strategy (Optional[ValidationStrategy], default: None ) –

    TThe option to relax the validation needed to create a template with definition objects. This skips the validation step for specific errors.

Raises:

  • AccessDeniedException –

    You don't have access to this item. The provided credentials couldn't be validated. You might not be authorized to carry out the request. Make sure that your account is authorized to use the Amazon Quick Sight service, that your policies have the correct permissions, and that you are using the correct credentials.

  • ConflictException –

    Updating or deleting a resource can cause an inconsistent state.

  • InternalFailureException –

    An internal failure occurred.

  • InvalidParameterValueException –

    One or more parameters has a value that isn't valid.

  • LimitExceededException –

    A limit is exceeded.

  • ResourceExistsException –

    The resource specified already exists.

  • ResourceNotFoundException –

    One or more resources can't be found.

  • ThrottlingException –

    Access is throttled.

  • UnsupportedUserEditionException –

    This error indicates that you are calling an operation on an Amazon Quick Suite subscription where the edition doesn't include support for that operation. Amazon Quick Suite currently has Standard Edition and Enterprise Edition. Not every operation and capability is available in every edition.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_quicksight/_services/quick_sight.py
def create_template(
    self,
    aws_account_id: "capo_quicksight.types.aws_account_id.AwsAccountId",
    template_id: "capo_quicksight.types.short_restrictive_resource_id.ShortRestrictiveResourceId",
    *,
    config_overrides: Optional[QuickSightClientConfig] = None,
    name: Optional["capo_quicksight.types.template_name.TemplateName"] = None,
    permissions: Optional[
        "capo_quicksight.types.resource_permission_list.ResourcePermissionList"
    ] = None,
    source_entity: Optional[
        "capo_quicksight.types.template_source_entity.TemplateSourceEntity"
    ] = None,
    tags: Optional["capo_quicksight.types.tag_list.TagList"] = None,
    version_description: Optional[
        "capo_quicksight.types.version_description.VersionDescription"
    ] = None,
    definition: Optional[
        "capo_quicksight.types.template_version_definition.TemplateVersionDefinition"
    ] = None,
    validation_strategy: Optional[
        "capo_quicksight.types.validation_strategy.ValidationStrategy"
    ] = None,
) -> "capo_quicksight.types.create_template_response.CreateTemplateResponse":
    """<p>Creates a template either from a <code>TemplateDefinition</code> or from an existing Quick Sight analysis or template. You can use the resulting template to create additional dashboards, templates, or analyses.</p> <p>A <i>template</i> is an entity in Quick Sight that encapsulates the metadata required to create an analysis and that you can use to create s dashboard. A template adds a layer of abstraction by using placeholders to replace the dataset associated with the analysis. You can use templates to create dashboards by replacing dataset placeholders with datasets that follow the same schema that was used to create the source analysis and template.</p>

    Args:
        aws_account_id: <p>The ID for the Amazon Web Services account that the group is in. You use the ID for the Amazon Web Services account that contains your Amazon Quick Sight account.</p>
        template_id: <p>An ID for the template that you want to create. This template is unique per Amazon Web Services Region; in each Amazon Web Services account.</p>
        name: <p>A display name for the template.</p>
        permissions: <p>A list of resource permissions to be set on the template. </p>
        source_entity: <p>The entity that you are using as a source when you create the template. In <code>SourceEntity</code>, you specify the type of object you're using as source: <code>SourceTemplate</code> for a template or <code>SourceAnalysis</code> for an analysis. Both of these require an Amazon Resource Name (ARN). For <code>SourceTemplate</code>, specify the ARN of the source template. For <code>SourceAnalysis</code>, specify the ARN of the source analysis. The <code>SourceTemplate</code> ARN can contain any Amazon Web Services account and any Quick Sight-supported Amazon Web Services Region. </p> <p>Use the <code>DataSetReferences</code> entity within <code>SourceTemplate</code> or <code>SourceAnalysis</code> to list the replacement datasets for the placeholders listed in the original. The schema in each dataset must match its placeholder. Use the <code>TopicReferences</code> entity to list the replacement topics for the topic placeholders listed in the original. The schema in each topic must match its placeholder.</p> <p>Either a <code>SourceEntity</code> or a <code>Definition</code> must be provided in order for the request to be valid.</p>
        tags: <p>Contains a map of the key-value pairs for the resource tag or tags assigned to the resource.</p>
        version_description: <p>A description of the current template version being created. This API operation creates the first version of the template. Every time <code>UpdateTemplate</code> is called, a new version is created. Each version of the template maintains a description of the version in the <code>VersionDescription</code> field.</p>
        definition: <p>The definition of a template.</p> <p>A definition is the data model of all features in a Dashboard, Template, or Analysis.</p> <p>Either a <code>SourceEntity</code> or a <code>Definition</code> must be provided in order for the request to be valid.</p>
        validation_strategy: <p>TThe option to relax the validation needed to create a template with definition objects. This skips the validation step for specific errors.</p>

    Raises:
        capo_quicksight.errors.access_denied_exception.AccessDeniedException: <p>You don't have access to this item. The provided credentials couldn't be validated. You might not be authorized to carry out the request. Make sure that your account is authorized to use the Amazon Quick Sight service, that your policies have the correct permissions, and that you are using the correct credentials.</p>
        capo_quicksight.errors.conflict_exception.ConflictException: <p>Updating or deleting a resource can cause an inconsistent state.</p>
        capo_quicksight.errors.internal_failure_exception.InternalFailureException: <p>An internal failure occurred.</p>
        capo_quicksight.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>One or more parameters has a value that isn't valid.</p>
        capo_quicksight.errors.limit_exceeded_exception.LimitExceededException: <p>A limit is exceeded.</p>
        capo_quicksight.errors.resource_exists_exception.ResourceExistsException: <p>The resource specified already exists. </p>
        capo_quicksight.errors.resource_not_found_exception.ResourceNotFoundException: <p>One or more resources can't be found.</p>
        capo_quicksight.errors.throttling_exception.ThrottlingException: <p>Access is throttled.</p>
        capo_quicksight.errors.unsupported_user_edition_exception.UnsupportedUserEditionException: <p>This error indicates that you are calling an operation on an Amazon Quick Suite subscription where the edition doesn't include support for that operation. Amazon Quick Suite currently has Standard Edition and Enterprise Edition. Not every operation and capability is available in every edition.</p>
        capo_quicksight.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_quicksight.types.create_template_request.CreateTemplateRequest]",
    ) -> OperationResponse[
        "capo_quicksight.types.create_template_response.CreateTemplateResponse"
    ]:
        import capo_quicksight._operations.quick_sight_20180401.create_template

        output, http_response = (
            capo_quicksight._operations.quick_sight_20180401.create_template.create_template(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_quicksight.types.create_template_request.CreateTemplateRequest",
    ) -> dict[str, Any]:
        import capo_quicksight.types.create_template_request

        return capo_quicksight.types.create_template_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateTemplate", redact_input=_redact_input),
    )
    input_: capo_quicksight.types.create_template_request.CreateTemplateRequest = {
        "aws_account_id": aws_account_id,
        "template_id": template_id,
    }
    if name is not None:
        input_["name"] = name
    if permissions is not None:
        input_["permissions"] = permissions
    if source_entity is not None:
        input_["source_entity"] = source_entity
    if tags is not None:
        input_["tags"] = tags
    if version_description is not None:
        input_["version_description"] = version_description
    if definition is not None:
        input_["definition"] = definition
    if validation_strategy is not None:
        input_["validation_strategy"] = validation_strategy

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output