Deletes the specified target group.
You can delete a target group if it is not referenced by any actions. Deleting a target group also deletes any associated health checks. Deleting a target group does not affect its registered targets. For example, any EC2 instances continue to run until you stop or terminate them.
Parameters:
-
target_group_arn
(Optional[TargetGroupArn], default:
None
)
–
The Amazon Resource Name (ARN) of the target group.
Raises:
Examples:
To delete a target group
This example deletes the specified target group.
>>> client.delete_target_group(target_group_arn='arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067')
Source code in docs_src/capo_elastic_load_balancing_v2/_services/elastic_load_balancingv2.py
| def delete_target_group(
self,
*,
config_overrides: Optional[ElasticLoadBalancingv2ClientConfig] = None,
target_group_arn: Optional[
"capo_elastic_load_balancing_v2.types.target_group_arn.TargetGroupArn"
] = None,
) -> "capo_elastic_load_balancing_v2.types.delete_target_group_output.DeleteTargetGroupOutput":
"""<p>Deletes the specified target group.</p> <p>You can delete a target group if it is not referenced by any actions. Deleting a target group also deletes any associated health checks. Deleting a target group does not affect its registered targets. For example, any EC2 instances continue to run until you stop or terminate them.</p>
Args:
target_group_arn: <p>The Amazon Resource Name (ARN) of the target group.</p>
Raises:
capo_elastic_load_balancing_v2.errors.resource_in_use_exception.ResourceInUseException: <p>A specified resource is in use.</p>
capo_elastic_load_balancing_v2.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
To delete a target group
This example deletes the specified target group.
>>> client.delete_target_group(target_group_arn='arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067')
"""
def _handler(
req: "OperationRequest[capo_elastic_load_balancing_v2.types.delete_target_group_input.DeleteTargetGroupInput]",
) -> OperationResponse[
"capo_elastic_load_balancing_v2.types.delete_target_group_output.DeleteTargetGroupOutput"
]:
import capo_elastic_load_balancing_v2._operations.elastic_load_balancing_v10.delete_target_group
output, http_response = (
capo_elastic_load_balancing_v2._operations.elastic_load_balancing_v10.delete_target_group.delete_target_group(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("DeleteTargetGroup")
)
input_: capo_elastic_load_balancing_v2.types.delete_target_group_input.DeleteTargetGroupInput = {}
if target_group_arn is not None:
input_["target_group_arn"] = target_group_arn
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|