Skip to content

create_provisioning_template async

create_provisioning_template(
    template_name: TemplateName,
    template_body: TemplateBody,
    provisioning_role_arn: RoleArn,
    *,
    config_overrides: Optional[AsyncIoTClientConfig] = None,
    description: Optional[TemplateDescription] = None,
    enabled: Optional[Enabled2] = None,
    pre_provisioning_hook: Optional[ProvisioningHook] = None,
    tags: Optional[TagList] = None,
    type: Optional[TemplateType] = None,
) -> CreateProvisioningTemplateResponse

Creates a provisioning template.

Requires permission to access the CreateProvisioningTemplate action.

Parameters:

  • template_name (TemplateName) –

    The name of the provisioning template.

  • description (Optional[TemplateDescription], default: None ) –

    The description of the provisioning template.

  • template_body (TemplateBody) –

    The JSON formatted contents of the provisioning template.

  • enabled (Optional[Enabled2], default: None ) –

    True to enable the provisioning template, otherwise false.

  • provisioning_role_arn (RoleArn) –

    The role ARN for the role associated with the provisioning template. This IoT role grants permission to provision a device.

  • pre_provisioning_hook (Optional[ProvisioningHook], default: None ) –

    Creates a pre-provisioning hook template. Only supports template of type FLEET_PROVISIONING. For more information about provisioning template types, see type.

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

    Metadata which can be used to manage the provisioning template.

    For URI Request parameters use format: ...key1=value1&key2=value2...

    For the CLI command-line parameter use format: &&tags "key1=value1&key2=value2..."

    For the cli-input-json file use format: "tags": "key1=value1&key2=value2..."

  • type (Optional[TemplateType], default: None ) –

    The type you define in a provisioning template. You can create a template with only one type. You can't change the template type after its creation. The default value is FLEET_PROVISIONING. For more information about provisioning template, see: Provisioning template.

Raises:

Source code in docs_src/capo_iot/_services/async_io_t.py
async def create_provisioning_template(
    self,
    template_name: "capo_iot.types.template_name.TemplateName",
    template_body: "capo_iot.types.template_body.TemplateBody",
    provisioning_role_arn: "capo_iot.types.role_arn.RoleArn",
    *,
    config_overrides: Optional[AsyncIoTClientConfig] = None,
    description: Optional[
        "capo_iot.types.template_description.TemplateDescription"
    ] = None,
    enabled: Optional["capo_iot.types.enabled2.Enabled2"] = None,
    pre_provisioning_hook: Optional[
        "capo_iot.types.provisioning_hook.ProvisioningHook"
    ] = None,
    tags: Optional["capo_iot.types.tag_list.TagList"] = None,
    type: Optional["capo_iot.types.template_type.TemplateType"] = None,
) -> "capo_iot.types.create_provisioning_template_response.CreateProvisioningTemplateResponse":
    """<p>Creates a provisioning template.</p> <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">CreateProvisioningTemplate</a> action.</p>

    Args:
        template_name: <p>The name of the provisioning template.</p>
        description: <p>The description of the provisioning template.</p>
        template_body: <p>The JSON formatted contents of the provisioning template.</p>
        enabled: <p>True to enable the provisioning template, otherwise false.</p>
        provisioning_role_arn: <p>The role ARN for the role associated with the provisioning template. This IoT role grants permission to provision a device.</p>
        pre_provisioning_hook: <p>Creates a pre-provisioning hook template. Only supports template of type <code>FLEET_PROVISIONING</code>. For more information about provisioning template types, see <a href="https://docs.aws.amazon.com/iot/latest/apireference/API_CreateProvisioningTemplate.html#iot-CreateProvisioningTemplate-request-type">type</a>.</p>
        tags: <p>Metadata which can be used to manage the provisioning template.</p> <note> <p>For URI Request parameters use format: ...key1=value1&key2=value2...</p> <p>For the CLI command-line parameter use format: &&tags "key1=value1&key2=value2..."</p> <p>For the cli-input-json file use format: "tags": "key1=value1&key2=value2..."</p> </note>
        type: <p>The type you define in a provisioning template. You can create a template with only one type. You can't change the template type after its creation. The default value is <code>FLEET_PROVISIONING</code>. For more information about provisioning template, see: <a href="https://docs.aws.amazon.com/iot/latest/developerguide/provision-template.html">Provisioning template</a>. </p>

    Raises:
        capo_iot.errors.internal_failure_exception.InternalFailureException: <p>An unexpected error has occurred.</p>
        capo_iot.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
        capo_iot.errors.limit_exceeded_exception.LimitExceededException: <p>A limit has been exceeded.</p>
        capo_iot.errors.resource_already_exists_exception.ResourceAlreadyExistsException: <p>The resource already exists.</p>
        capo_iot.errors.throttling_exception.ThrottlingException: <p>The rate exceeds the limit.</p>
        capo_iot.errors.unauthorized_exception.UnauthorizedException: <p>You are not authorized to perform this operation.</p>
        capo_iot.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_iot.types.create_provisioning_template_request.CreateProvisioningTemplateRequest]",
    ) -> AsyncOperationResponse[
        "capo_iot.types.create_provisioning_template_response.CreateProvisioningTemplateResponse"
    ]:
        import capo_iot._operations.aws_iot_service.create_provisioning_template

        (
            output,
            http_response,
        ) = await capo_iot._operations.aws_iot_service.create_provisioning_template.async_create_provisioning_template(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateProvisioningTemplate")
    )
    input_: capo_iot.types.create_provisioning_template_request.CreateProvisioningTemplateRequest = {
        "template_name": template_name,
        "template_body": template_body,
        "provisioning_role_arn": provisioning_role_arn,
    }
    if description is not None:
        input_["description"] = description
    if enabled is not None:
        input_["enabled"] = enabled
    if pre_provisioning_hook is not None:
        input_["pre_provisioning_hook"] = pre_provisioning_hook
    if tags is not None:
        input_["tags"] = tags
    if type is not None:
        input_["type"] = type

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output