Skip to content

delete_placement_group async

delete_placement_group(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    dry_run: Optional[Boolean] = None,
    group_name: Optional[PlacementGroupNameWithResolver] = None,
) -> None

Deletes the specified placement group. You must terminate all instances in the placement group before you can delete the placement group. You cannot delete a placement group that is a parent of a cluster placement group. Delete the cluster placement groups first. For more information, see Placement groups in the Amazon EC2 User Guide.

Parameters:

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

    Checks whether you have the required permissions for the operation, 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.

  • group_name (Optional[PlacementGroupNameWithResolver], default: None ) –

    The name of the placement group.

Raises:

Examples:

To delete a placement group This example deletes the specified placement group.

>>> await client.delete_placement_group(group_name='my-cluster')
Source code in docs_src/capo_ec2/_services/async_ec2.py
async def delete_placement_group(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
    group_name: Optional[
        "capo_ec2.types.placement_group_name_with_resolver.PlacementGroupNameWithResolver"
    ] = None,
) -> None:
    """<p>Deletes the specified placement group. You must terminate all instances in the placement group before you can delete the placement group. You cannot delete a placement group that is a parent of a cluster placement group. Delete the cluster placement groups first. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html">Placement groups</a> in the <i>Amazon EC2 User Guide</i>.</p>

    Args:
        dry_run: <p>Checks whether you have the required permissions for the operation, 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>
        group_name: <p>The name of the placement group.</p>

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

    Examples:
        To delete a placement group
        This example deletes the specified placement group.


        >>> await client.delete_placement_group(group_name='my-cluster')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ec2.types.delete_placement_group_request.DeletePlacementGroupRequest]",
    ) -> AsyncOperationResponse[None]:
        import capo_ec2._operations.amazon_ec2.delete_placement_group

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeletePlacementGroup")
    )
    input_: capo_ec2.types.delete_placement_group_request.DeletePlacementGroupRequest = {}
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if group_name is not None:
        input_["group_name"] = group_name

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