in python/gwlb/delete_tg_sample.py [0:0]
def delete_tg(tg_arn):
"""
Deletes target group and returns response
Accepts:
- tg_arn: Target group ARN. Not required if retrieving from DynamoDB
Usage:
- delete_tg('arn:aws:elasticloadbalancing:xxxxx')
"""
logging.info("Deleting target group:")
try:
response = elbv2.delete_target_group(TargetGroupArn=tg_arn)
return response
except ClientError as e:
logging.error(e)
return None