Skip to content

delete_dhcp_options async

delete_dhcp_options(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    dhcp_options_id: Optional[DhcpOptionsId] = None,
    dry_run: Optional[Boolean] = None,
) -> None

Deletes the specified set of DHCP options. You must disassociate the set of DHCP options before you can delete it. You can disassociate the set of DHCP options by associating either a new set of options or the default set of options with the VPC.

Parameters:

  • dhcp_options_id (Optional[DhcpOptionsId], default: None ) –

    The ID of the DHCP options set.

  • 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.

Raises:

Examples:

To delete a DHCP options set This example deletes the specified DHCP options set.

>>> await client.delete_dhcp_options(dhcp_options_id='dopt-d9070ebb')
Source code in docs_src/capo_ec2/_services/async_ec2.py
async def delete_dhcp_options(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    dhcp_options_id: Optional[
        "capo_ec2.types.dhcp_options_id.DhcpOptionsId"
    ] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
) -> None:
    """<p>Deletes the specified set of DHCP options. You must disassociate the set of DHCP options before you can delete it. You can disassociate the set of DHCP options by associating either a new set of options or the default set of options with the VPC.</p>

    Args:
        dhcp_options_id: <p>The ID of the DHCP options set.</p>
        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>

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

    Examples:
        To delete a DHCP options set
        This example deletes the specified DHCP options set.

        >>> await client.delete_dhcp_options(dhcp_options_id='dopt-d9070ebb')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ec2.types.delete_dhcp_options_request.DeleteDhcpOptionsRequest]",
    ) -> AsyncOperationResponse[None]:
        import capo_ec2._operations.amazon_ec2.delete_dhcp_options

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteDhcpOptions")
    )
    input_: capo_ec2.types.delete_dhcp_options_request.DeleteDhcpOptionsRequest = {}
    if dhcp_options_id is not None:
        input_["dhcp_options_id"] = dhcp_options_id
    if dry_run is not None:
        input_["dry_run"] = dry_run

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