-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #964 from sirosen/get-subscription-info
Add `get-subscription-info` command + share fields
- Loading branch information
Showing
8 changed files
with
127 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
### Enhancements | ||
|
||
* Add `globus group get-subscription-info` command to display a subscription. | ||
* `globus group show` now displays subscription-related information for groups | ||
when present. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from __future__ import annotations | ||
|
||
import uuid | ||
|
||
import click | ||
|
||
from globus_cli.login_manager import LoginManager | ||
from globus_cli.parsing import command | ||
from globus_cli.termio import Field, TextMode, display | ||
|
||
from ._common import SUBSCRIPTION_FIELDS | ||
|
||
|
||
@click.argument("subscription_id", type=click.UUID) | ||
@command("get-subscription-info") | ||
@LoginManager.requires_login("groups") | ||
def group_get_subscription_info( | ||
login_manager: LoginManager, *, subscription_id: uuid.UUID | ||
) -> None: | ||
"""Show data about a specific Subscription.""" | ||
groups_client = login_manager.get_groups_client() | ||
|
||
subscription_data = groups_client.get(f"/subscription_info/{subscription_id}") | ||
display( | ||
subscription_data, | ||
text_mode=TextMode.text_record, | ||
fields=[Field("Group ID", "group_id")] + SUBSCRIPTION_FIELDS, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import uuid | ||
|
||
from globus_sdk._testing import RegisteredResponse | ||
|
||
|
||
def test_group_get_subscription_info_text(run_line): | ||
subscription_id = str(uuid.uuid1()) | ||
group_id = str(uuid.uuid1()) | ||
connector_id = str(uuid.uuid1()) | ||
|
||
RegisteredResponse( | ||
service="groups", | ||
path=f"/subscription_info/{subscription_id}", | ||
json={ | ||
"group_id": group_id, | ||
"subscription_id": subscription_id, | ||
"subscription_info": { | ||
"connectors": { | ||
connector_id: { | ||
"is_baa": False, | ||
"is_ha": True, | ||
} | ||
}, | ||
"is_baa": False, | ||
"is_high_assurance": False, | ||
}, | ||
}, | ||
).add() | ||
|
||
run_line( | ||
f"globus group get-subscription-info {subscription_id}", | ||
search_stdout=[ | ||
("Group ID", group_id), | ||
("Subscription ID", subscription_id), | ||
("BAA", "False"), | ||
("High Assurance", "False"), | ||
], | ||
) |