2022-10-25 14:21:37 +08:00
|
|
|
#!/bin/bash
|
2023-05-23 13:10:16 +08:00
|
|
|
eval "$(jq -r '@sh "export lb=\(.input) asrolearn=\(.asrolearn)"')"
|
|
|
|
eval "$(aws sts assume-role --role-arn $asrolearn --role-session-name awscli | jq -cr '"export AWS_ACCESS_KEY_ID=" + .Credentials.AccessKeyId, "export AWS_SECRET_ACCESS_KEY=" + .Credentials.SecretAccessKey, "export AWS_SESSION_TOKEN=" + .Credentials.SessionToken')"
|
2022-10-25 14:21:37 +08:00
|
|
|
|
|
|
|
RESULTS=$(aws elbv2 describe-target-groups --load-balancer-arn $lb --query TargetGroups[*].TargetGroupArn --output text --no-cli-pager | sed 's/\t/\n/g' | sort | xargs)
|
2022-11-03 11:39:31 +08:00
|
|
|
jq -n --arg result "$RESULTS" '{"result":$result}'
|
2022-10-25 14:21:37 +08:00
|
|
|
|