Skip to content

create_template async

create_template(
    template_name: str,
    template_source: TemplateSource,
    *,
    config_overrides: Optional[AsyncMigrationHubOrchestratorClientConfig] = None,
    template_description: Optional[str] = None,
    client_token: Optional[ClientToken] = None,
    tags: Optional[TagMap] = None,
) -> CreateTemplateResponse

Creates a migration workflow template.

Parameters:

  • template_name (str) –

    The name of the migration workflow template.

  • template_description (Optional[str], default: None ) –

    A description of the migration workflow template.

  • template_source (TemplateSource) –

    The source of the migration workflow template.

  • client_token (Optional[ClientToken], default: None ) –

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Idempotency in the Smithy documentation.

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

    The tags to add to the migration workflow template.

Raises:

Source code in docs_src/capo_migrationhuborchestrator/_services/async_migration_hub_orchestrator.py
async def create_template(
    self,
    template_name: str,
    template_source: "capo_migrationhuborchestrator.types.template_source.TemplateSource",
    *,
    config_overrides: Optional[AsyncMigrationHubOrchestratorClientConfig] = None,
    template_description: Optional[str] = None,
    client_token: Optional[
        "capo_migrationhuborchestrator.types.client_token.ClientToken"
    ] = None,
    tags: Optional["capo_migrationhuborchestrator.types.tag_map.TagMap"] = None,
) -> "capo_migrationhuborchestrator.types.create_template_response.CreateTemplateResponse":
    """<p>Creates a migration workflow template.</p>

    Args:
        template_name: <p>The name of the migration workflow template.</p>
        template_description: <p>A description of the migration workflow template.</p>
        template_source: <p>The source of the migration workflow template.</p>
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see <a href="https://smithy.io/2.0/spec/behavior-traits.html#idempotencytoken-trait">Idempotency</a> in the Smithy documentation.</p>
        tags: <p>The tags to add to the migration workflow template.</p>

    Raises:
        capo_migrationhuborchestrator.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_migrationhuborchestrator.errors.conflict_exception.ConflictException: <p>This exception is thrown when an attempt to update or delete a resource would cause an inconsistent state.</p>
        capo_migrationhuborchestrator.errors.internal_server_exception.InternalServerException: <p>An internal error has occurred.</p>
        capo_migrationhuborchestrator.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_migrationhuborchestrator.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by an AWS service.</p>
        capo_migrationhuborchestrator.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_migrationhuborchestrator.types.create_template_request.CreateTemplateRequest]",
    ) -> AsyncOperationResponse[
        "capo_migrationhuborchestrator.types.create_template_response.CreateTemplateResponse"
    ]:
        import capo_migrationhuborchestrator._operations.aws_migration_hub_orchestrator.create_template

        (
            output,
            http_response,
        ) = await capo_migrationhuborchestrator._operations.aws_migration_hub_orchestrator.create_template.async_create_template(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateTemplate")
    )
    input_: capo_migrationhuborchestrator.types.create_template_request.CreateTemplateRequest = {
        "template_name": template_name,
        "template_source": template_source,
    }
    if template_description is not None:
        input_["template_description"] = template_description
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if tags is not None:
        input_["tags"] = tags

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