Skip to content

Instantly share code, notes, and snippets.

@francoiscampbell
Created August 20, 2020 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save francoiscampbell/bc23bbf6210d5fbfdd32d2e692ff7b9c to your computer and use it in GitHub Desktop.
Save francoiscampbell/bc23bbf6210d5fbfdd32d2e692ff7b9c to your computer and use it in GitHub Desktop.
tg_foo_bar = TargetGroupArn(
"arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup/foo-bar/abc123"
)
# generate a new ARN from the first one
tg_baz_quz = TargetGroupArn(
target_group_arn,
name="baz-qux",
internal_id="def456",
)
# the fields were overridden
assert tg_baz_quz.name == "baz-qux"
assert tg_baz_quz.internal_id == "def456"
# and the new ARN is the str() of the object
assert str(tg_baz_quz) == (
"arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup/baz-qux/def456"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment