Skip to content

create_template

create_template(
    domain_id: DomainId,
    name: TemplateName,
    *,
    config_overrides: Optional[ConnectCasesClientConfig] = None,
    description: Optional[TemplateDescription] = None,
    layout_configuration: Optional[LayoutConfiguration] = None,
    required_fields: Optional[RequiredFieldList] = None,
    status: Optional[TemplateStatus] = None,
    rules: Optional[TemplateCaseRuleList] = None,
    tag_propagation_configurations: Optional[TagPropagationConfigurationList] = None,
) -> CreateTemplateResponse

Creates a template in the Cases domain. This template is used to define the case object model (that is, to define what data can be captured on cases) in a Cases domain. A template must have a unique name within a domain, and it must reference existing field IDs and layout IDs. Additionally, multiple fields with same IDs are not allowed within the same Template. A template can be either Active or Inactive, as indicated by its status. Inactive templates cannot be used to create cases.

Other template APIs are:

Parameters:

Raises:

  • AccessDeniedException –

    You do not have sufficient access to perform this action.

  • ConflictException –

    The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request. See the accompanying error message for details.

  • InternalServerException –

    We couldn't process your request because of an issue with the server. Try again later.

  • ResourceNotFoundException –

    We couldn't find the requested resource. Check that your resources exists and were created in the same Amazon Web Services Region as your request, and try your request again.

  • ServiceQuotaExceededException –

    The service quota has been exceeded. For a list of service quotas, see Amazon Connect Service Quotas in the Amazon Connect Administrator Guide.

  • ThrottlingException –

    The rate has been exceeded for this API. Please try again after a few minutes.

  • ValidationException –

    The request isn't valid. Check the syntax and try again.

  • UnknownServiceError –

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

Source code in docs_src/capo_connectcases/_services/connect_cases.py
def create_template(
    self,
    domain_id: "capo_connectcases.types.domain_id.DomainId",
    name: "capo_connectcases.types.template_name.TemplateName",
    *,
    config_overrides: Optional[ConnectCasesClientConfig] = None,
    description: Optional[
        "capo_connectcases.types.template_description.TemplateDescription"
    ] = None,
    layout_configuration: Optional[
        "capo_connectcases.types.layout_configuration.LayoutConfiguration"
    ] = None,
    required_fields: Optional[
        "capo_connectcases.types.required_field_list.RequiredFieldList"
    ] = None,
    status: Optional[
        "capo_connectcases.types.template_status.TemplateStatus"
    ] = None,
    rules: Optional[
        "capo_connectcases.types.template_case_rule_list.TemplateCaseRuleList"
    ] = None,
    tag_propagation_configurations: Optional[
        "capo_connectcases.types.tag_propagation_configuration_list.TagPropagationConfigurationList"
    ] = None,
) -> "capo_connectcases.types.create_template_response.CreateTemplateResponse":
    """<p>Creates a template in the Cases domain. This template is used to define the case object model (that is, to define what data can be captured on cases) in a Cases domain. A template must have a unique name within a domain, and it must reference existing field IDs and layout IDs. Additionally, multiple fields with same IDs are not allowed within the same Template. A template can be either Active or Inactive, as indicated by its status. Inactive templates cannot be used to create cases.</p> <p> Other template APIs are: </p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_connect-cases_DeleteTemplate.html">DeleteTemplate</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_connect-cases_GetTemplate.html">GetTemplate</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_connect-cases_ListTemplates.html">ListTemplates</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_connect-cases_UpdateTemplate.html">UpdateTemplate</a> </p> </li> </ul>

    Args:
        domain_id: <p>The unique identifier of the Cases domain. </p>
        name: <p>A name for the template. It must be unique per domain.</p>
        description: <p>A brief description of the template.</p>
        layout_configuration: <p>Configuration of layouts associated to the template.</p>
        required_fields: <p>A list of fields that must contain a value for a case to be successfully created with this template.</p>
        status: <p>The status of the template.</p>
        rules: <p>A list of case rules (also known as <a href="https://docs.aws.amazon.com/connect/latest/adminguide/case-field-conditions.html">case field conditions</a>) on a template. </p>
        tag_propagation_configurations: <p>Defines tag propagation configuration for resources created within a domain. Tags specified here will be automatically applied to resources being created for the specified resource type.</p>

    Raises:
        capo_connectcases.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_connectcases.errors.conflict_exception.ConflictException: <p>The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request. See the accompanying error message for details.</p>
        capo_connectcases.errors.internal_server_exception.InternalServerException: <p>We couldn't process your request because of an issue with the server. Try again later.</p>
        capo_connectcases.errors.resource_not_found_exception.ResourceNotFoundException: <p>We couldn't find the requested resource. Check that your resources exists and were created in the same Amazon Web Services Region as your request, and try your request again.</p>
        capo_connectcases.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The service quota has been exceeded. For a list of service quotas, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/amazon-connect-service-limits.html">Amazon Connect Service Quotas</a> in the <i>Amazon Connect Administrator Guide</i>.</p>
        capo_connectcases.errors.throttling_exception.ThrottlingException: <p>The rate has been exceeded for this API. Please try again after a few minutes.</p>
        capo_connectcases.errors.validation_exception.ValidationException: <p>The request isn't valid. Check the syntax and try again.</p>
        capo_connectcases.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

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

        output, http_response = (
            capo_connectcases._operations.amazon_connect_cases.create_template.create_template(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateTemplate")
    )
    input_: capo_connectcases.types.create_template_request.CreateTemplateRequest = {
        "domain_id": domain_id,
        "name": name,
    }
    if description is not None:
        input_["description"] = description
    if layout_configuration is not None:
        input_["layout_configuration"] = layout_configuration
    if required_fields is not None:
        input_["required_fields"] = required_fields
    if status is not None:
        input_["status"] = status
    if rules is not None:
        input_["rules"] = rules
    if tag_propagation_configurations is not None:
        input_["tag_propagation_configurations"] = tag_propagation_configurations

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