Skip to content

delete_launch_template async

delete_launch_template(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    dry_run: Optional[Boolean] = None,
    launch_template_id: Optional[LaunchTemplateId] = None,
    launch_template_name: Optional[LaunchTemplateName] = None,
) -> DeleteLaunchTemplateResult

Deletes a launch template. Deleting a launch template deletes all of its versions.

Parameters:

  • dry_run (Optional[Boolean], default: None ) –

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • launch_template_id (Optional[LaunchTemplateId], default: None ) –

    The ID of the launch template.

    You must specify either the launch template ID or the launch template name, but not both.

  • launch_template_name (Optional[LaunchTemplateName], default: None ) –

    The name of the launch template.

    You must specify either the launch template ID or the launch template name, but not both.

Raises:

Examples:

To delete a launch template This example deletes the specified launch template.

>>> await client.delete_launch_template(launch_template_id='lt-0abcd290751193123')
Source code in docs_src/capo_ec2/_services/async_ec2.py
async def delete_launch_template(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
    launch_template_id: Optional[
        "capo_ec2.types.launch_template_id.LaunchTemplateId"
    ] = None,
    launch_template_name: Optional[
        "capo_ec2.types.launch_template_name.LaunchTemplateName"
    ] = None,
) -> "capo_ec2.types.delete_launch_template_result.DeleteLaunchTemplateResult":
    """<p>Deletes a launch template. Deleting a launch template deletes all of its versions.</p>

    Args:
        dry_run: <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
        launch_template_id: <p>The ID of the launch template.</p> <p>You must specify either the launch template ID or the launch template name, but not both.</p>
        launch_template_name: <p>The name of the launch template.</p> <p>You must specify either the launch template ID or the launch template name, but not both.</p>

    Raises:
        capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To delete a launch template
        This example deletes the specified launch template.

        >>> await client.delete_launch_template(launch_template_id='lt-0abcd290751193123')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ec2.types.delete_launch_template_request.DeleteLaunchTemplateRequest]",
    ) -> AsyncOperationResponse[
        "capo_ec2.types.delete_launch_template_result.DeleteLaunchTemplateResult"
    ]:
        import capo_ec2._operations.amazon_ec2.delete_launch_template

        (
            output,
            http_response,
        ) = await capo_ec2._operations.amazon_ec2.delete_launch_template.async_delete_launch_template(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteLaunchTemplate")
    )
    input_: capo_ec2.types.delete_launch_template_request.DeleteLaunchTemplateRequest = {}
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if launch_template_id is not None:
        input_["launch_template_id"] = launch_template_id
    if launch_template_name is not None:
        input_["launch_template_name"] = launch_template_name

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