Skip to content

Commit

Permalink
Add --allowed-subnets option to CLI (close #17)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-hamann committed Aug 24, 2024
1 parent ccd4eac commit 4f6fc1e
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions desec.py
Original file line number Diff line number Diff line change
Expand Up @@ -1587,6 +1587,11 @@ def _main() -> None:
default=False,
help="create a token that can manage tokens",
)
p.add_argument(

Check warning on line 1590 in desec.py

View check run for this annotation

Codecov / codecov/patch

desec.py#L1590

Added line #L1590 was not covered by tests
"--allowed-subnets",
action="append",
help="IPv4/IPv6 addresses or subnets from which clients may authenticate with this token",
)

p = p_action.add_parser("modify-token", help="modify an existing authentication token")
p.add_argument("id", help="token id")
Expand All @@ -1606,6 +1611,11 @@ def _main() -> None:
default=None,
help="do not allow this token to manage tokens",
)
p.add_argument(

Check warning on line 1614 in desec.py

View check run for this annotation

Codecov / codecov/patch

desec.py#L1614

Added line #L1614 was not covered by tests
"--allowed-subnets",
action="append",
help="IPv4/IPv6 addresses or subnets from which clients may authenticate with this token",
)

p = p_action.add_parser("delete-token", help="delete an authentication token")
p.add_argument("id", help="token id")
Expand Down Expand Up @@ -1980,12 +1990,14 @@ def _main() -> None:
pprint(tokens_result)

elif arguments.action == "create-token":
new_token_result = api_client.create_token(arguments.name, arguments.manage_tokens)
new_token_result = api_client.create_token(

Check warning on line 1993 in desec.py

View check run for this annotation

Codecov / codecov/patch

desec.py#L1993

Added line #L1993 was not covered by tests
arguments.name, arguments.manage_tokens, arguments.allowed_subnets
)
print(new_token_result["token"])

elif arguments.action == "modify-token":
token_result = api_client.modify_token(
arguments.id, arguments.name, arguments.manage_tokens
arguments.id, arguments.name, arguments.manage_tokens, arguments.allowed_subnets
)
pprint(token_result)

Expand Down

0 comments on commit 4f6fc1e

Please sign in to comment.