yellowdog-python-examples 7.16.4__tar.gz → 7.16.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {yellowdog_python_examples-7.16.4/yellowdog_python_examples.egg-info → yellowdog_python_examples-7.16.6}/PKG-INFO +1 -1
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/README.md +8 -0
- yellowdog_python_examples-7.16.6/yellowdog_cli/__init__.py +1 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/create.py +6 -5
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/list.py +118 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/submit.py +2 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/args.py +44 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/items.py +10 -2
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/printing.py +141 -3
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/settings.py +1 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6/yellowdog_python_examples.egg-info}/PKG-INFO +1 -1
- yellowdog_python_examples-7.16.4/yellowdog_cli/__init__.py +0 -1
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/LICENSE +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/PYPI_README.md +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/pyproject.toml +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/requirements.txt +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/setup.cfg +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/tests/test_create_remove.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/tests/test_demos.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/tests/test_dryruns.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/tests/test_entrypoints.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/tests/test_gui.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/tests/test_list.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/tests/test_objects.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/tests/test_variable_processing.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/abort.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/admin.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/boost.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/cancel.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/cloudwizard.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/compare.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/delete.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/download.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/follow.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/format_json.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/hold.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/instantiate.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/jsonnet2json.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/provision.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/remove.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/resize.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/show.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/shutdown.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/start.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/terminate.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/upload.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/__init__.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/check_imports.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/cloudwizard_aws.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/cloudwizard_aws_types.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/cloudwizard_azure.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/cloudwizard_common.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/cloudwizard_gcp.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/compact_json.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/config_types.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/csv_data.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/entity_utils.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/follow_utils.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/interactive.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/load_config.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/load_resources.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/misc_utils.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/property_names.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/provision_utils.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/rich_console_input_fixed.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/start_hold_common.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/submit_utils.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/type_check.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/upload_utils.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/validate_properties.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/variables.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/wrapper.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/ydid_utils.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/version.py +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_python_examples.egg-info/SOURCES.txt +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_python_examples.egg-info/dependency_links.txt +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_python_examples.egg-info/entry_points.txt +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_python_examples.egg-info/requires.txt +0 -0
- {yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_python_examples.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: yellowdog-python-examples
|
|
3
|
-
Version: 7.16.
|
|
3
|
+
Version: 7.16.6
|
|
4
4
|
Summary: Python CLI commands using the YellowDog Python SDK
|
|
5
5
|
Author-email: YellowDog Limited <support@yellowdog.co>
|
|
6
6
|
Project-URL: Homepage, https://github.com/yellowdog/python-examples
|
|
@@ -2720,10 +2720,12 @@ The `yd-terminate` command immediately terminates Compute Requirements that matc
|
|
|
2720
2720
|
The `yd-list` command is used to list various YellowDog items, using the `namespace` and `tag` properties (if applicable) to target the scope of what to list:
|
|
2721
2721
|
|
|
2722
2722
|
- Allowances
|
|
2723
|
+
- Applications
|
|
2723
2724
|
- Attribute Definitions
|
|
2724
2725
|
- Compute Requirement Templates
|
|
2725
2726
|
- Compute Requirements
|
|
2726
2727
|
- Compute Source Templates
|
|
2728
|
+
- Groups
|
|
2727
2729
|
- Image Families, Image Groups, and Images
|
|
2728
2730
|
- Instances
|
|
2729
2731
|
- Keyrings
|
|
@@ -2731,8 +2733,10 @@ The `yd-list` command is used to list various YellowDog items, using the `namesp
|
|
|
2731
2733
|
- Namespace Storage Configurations
|
|
2732
2734
|
- Nodes
|
|
2733
2735
|
- Objects in the Object Store
|
|
2736
|
+
- Roles
|
|
2734
2737
|
- Task Groups
|
|
2735
2738
|
- Tasks
|
|
2739
|
+
- Users
|
|
2736
2740
|
- Work Requirements
|
|
2737
2741
|
- Worker Pools
|
|
2738
2742
|
- Workers
|
|
@@ -2811,6 +2815,10 @@ The `yd-show` command will show the details (in JSON) of any YellowDog entity th
|
|
|
2811
2815
|
- Image Families, Image Groups, and Images
|
|
2812
2816
|
- Keyrings
|
|
2813
2817
|
- Allowances
|
|
2818
|
+
- Users
|
|
2819
|
+
- Applications
|
|
2820
|
+
- Groups
|
|
2821
|
+
- Roles
|
|
2814
2822
|
|
|
2815
2823
|
## yd-compare
|
|
2816
2824
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "7.16.6"
|
{yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/create.py
RENAMED
|
@@ -337,11 +337,12 @@ def create_compute_requirement_template(resource: Dict):
|
|
|
337
337
|
print_json(resource)
|
|
338
338
|
return
|
|
339
339
|
|
|
340
|
-
# Overwrite source dictionaries with ComputeSourceUsage objects
|
|
341
|
-
resource
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
340
|
+
# Overwrite source dictionaries with ComputeSourceUsage objects for static CRTs
|
|
341
|
+
if resource.get(PROP_SOURCES) is not None:
|
|
342
|
+
resource[PROP_SOURCES] = [
|
|
343
|
+
_get_model_object("ComputeSourceUsage", source)
|
|
344
|
+
for source in resource.get(PROP_SOURCES, [])
|
|
345
|
+
]
|
|
345
346
|
|
|
346
347
|
compute_template = _get_model_object(type, resource)
|
|
347
348
|
|
|
@@ -15,11 +15,16 @@ from yellowdog_client.common import SearchClient
|
|
|
15
15
|
from yellowdog_client.model import (
|
|
16
16
|
Allowance,
|
|
17
17
|
AllowanceSearch,
|
|
18
|
+
Application,
|
|
19
|
+
ApplicationSearch,
|
|
18
20
|
ComputeRequirement,
|
|
19
21
|
ComputeRequirementSearch,
|
|
20
22
|
ComputeRequirementStatus,
|
|
21
23
|
ComputeRequirementTemplateSummary,
|
|
22
24
|
ComputeSourceTemplateSummary,
|
|
25
|
+
Group,
|
|
26
|
+
GroupSearch,
|
|
27
|
+
GroupSummary,
|
|
23
28
|
Instance,
|
|
24
29
|
InstanceSearch,
|
|
25
30
|
Keyring,
|
|
@@ -33,8 +38,13 @@ from yellowdog_client.model import (
|
|
|
33
38
|
NodeSearch,
|
|
34
39
|
NodeStatus,
|
|
35
40
|
ObjectDetail,
|
|
41
|
+
Role,
|
|
42
|
+
RoleSearch,
|
|
43
|
+
RoleSummary,
|
|
36
44
|
Task,
|
|
37
45
|
TaskGroup,
|
|
46
|
+
User,
|
|
47
|
+
UserSearch,
|
|
38
48
|
Worker,
|
|
39
49
|
WorkerPoolStatus,
|
|
40
50
|
WorkerPoolSummary,
|
|
@@ -114,6 +124,14 @@ def main():
|
|
|
114
124
|
list_attribute_definitions()
|
|
115
125
|
elif ARGS_PARSER.namespace_policies:
|
|
116
126
|
list_namespace_policies()
|
|
127
|
+
elif ARGS_PARSER.users:
|
|
128
|
+
list_users()
|
|
129
|
+
elif ARGS_PARSER.applications:
|
|
130
|
+
list_applications()
|
|
131
|
+
elif ARGS_PARSER.groups:
|
|
132
|
+
list_groups()
|
|
133
|
+
elif ARGS_PARSER.roles:
|
|
134
|
+
list_roles()
|
|
117
135
|
|
|
118
136
|
|
|
119
137
|
def check_for_valid_option() -> bool:
|
|
@@ -122,9 +140,11 @@ def check_for_valid_option() -> bool:
|
|
|
122
140
|
"""
|
|
123
141
|
if [
|
|
124
142
|
ARGS_PARSER.allowances,
|
|
143
|
+
ARGS_PARSER.applications,
|
|
125
144
|
ARGS_PARSER.attribute_definitions,
|
|
126
145
|
ARGS_PARSER.compute_requirements,
|
|
127
146
|
ARGS_PARSER.compute_templates,
|
|
147
|
+
ARGS_PARSER.groups,
|
|
128
148
|
ARGS_PARSER.image_families,
|
|
129
149
|
ARGS_PARSER.instances,
|
|
130
150
|
ARGS_PARSER.keyrings,
|
|
@@ -133,8 +153,10 @@ def check_for_valid_option() -> bool:
|
|
|
133
153
|
ARGS_PARSER.nodes,
|
|
134
154
|
ARGS_PARSER.object_paths,
|
|
135
155
|
ARGS_PARSER.source_templates,
|
|
156
|
+
ARGS_PARSER.roles,
|
|
136
157
|
ARGS_PARSER.task_groups,
|
|
137
158
|
ARGS_PARSER.tasks,
|
|
159
|
+
ARGS_PARSER.users,
|
|
138
160
|
ARGS_PARSER.work_requirements,
|
|
139
161
|
ARGS_PARSER.worker_pools,
|
|
140
162
|
ARGS_PARSER.workers,
|
|
@@ -846,6 +868,102 @@ def list_namespace_policies():
|
|
|
846
868
|
print_json(details)
|
|
847
869
|
|
|
848
870
|
|
|
871
|
+
def list_users():
|
|
872
|
+
"""
|
|
873
|
+
List all users in the account.
|
|
874
|
+
"""
|
|
875
|
+
user_search = UserSearch()
|
|
876
|
+
search_client: SearchClient = CLIENT.account_client.get_users(user_search)
|
|
877
|
+
users: List[User] = search_client.list_all()
|
|
878
|
+
|
|
879
|
+
users.sort(key=lambda user: user.name)
|
|
880
|
+
|
|
881
|
+
if len(users) == 0:
|
|
882
|
+
print_log("No Users to display")
|
|
883
|
+
return
|
|
884
|
+
|
|
885
|
+
if not ARGS_PARSER.details:
|
|
886
|
+
print_numbered_object_list(CLIENT, users, object_type_name="User")
|
|
887
|
+
return
|
|
888
|
+
|
|
889
|
+
for selected_users in select(CLIENT, users, object_type_name="User"):
|
|
890
|
+
print_yd_object(selected_users)
|
|
891
|
+
|
|
892
|
+
|
|
893
|
+
def list_applications():
|
|
894
|
+
"""
|
|
895
|
+
List all applications in the account.
|
|
896
|
+
"""
|
|
897
|
+
application_search = ApplicationSearch()
|
|
898
|
+
search_client: SearchClient = CLIENT.account_client.get_applications(
|
|
899
|
+
application_search
|
|
900
|
+
)
|
|
901
|
+
applications: List[Application] = search_client.list_all()
|
|
902
|
+
applications.sort(key=lambda app: app.name)
|
|
903
|
+
|
|
904
|
+
if len(applications) == 0:
|
|
905
|
+
print_log("No Applications to display")
|
|
906
|
+
return
|
|
907
|
+
|
|
908
|
+
if not ARGS_PARSER.details:
|
|
909
|
+
print_numbered_object_list(CLIENT, applications, object_type_name="Application")
|
|
910
|
+
return
|
|
911
|
+
|
|
912
|
+
for selected_users in select(CLIENT, applications, object_type_name="Application"):
|
|
913
|
+
print_yd_object(selected_users)
|
|
914
|
+
|
|
915
|
+
|
|
916
|
+
def list_groups():
|
|
917
|
+
"""
|
|
918
|
+
List all groups in the account.
|
|
919
|
+
"""
|
|
920
|
+
group_search = GroupSearch()
|
|
921
|
+
search_client: SearchClient = CLIENT.account_client.get_groups(group_search)
|
|
922
|
+
group_summaries: List[GroupSummary] = search_client.list_all()
|
|
923
|
+
|
|
924
|
+
if len(group_summaries) == 0:
|
|
925
|
+
print_log("No Groups to display")
|
|
926
|
+
return
|
|
927
|
+
|
|
928
|
+
group_summaries.sort(key=lambda group: group.name if group.name is not None else "")
|
|
929
|
+
|
|
930
|
+
groups: List[Group] = [
|
|
931
|
+
CLIENT.account_client.get_group(x.id) for x in group_summaries
|
|
932
|
+
]
|
|
933
|
+
|
|
934
|
+
if not ARGS_PARSER.details:
|
|
935
|
+
print_numbered_object_list(CLIENT, groups, object_type_name="Group")
|
|
936
|
+
return
|
|
937
|
+
|
|
938
|
+
for selected_users in select(CLIENT, groups, object_type_name="Group"):
|
|
939
|
+
print_yd_object(selected_users)
|
|
940
|
+
|
|
941
|
+
|
|
942
|
+
def list_roles():
|
|
943
|
+
"""
|
|
944
|
+
List all roles in the account.
|
|
945
|
+
"""
|
|
946
|
+
role_search = RoleSearch()
|
|
947
|
+
search_client: SearchClient = CLIENT.account_client.get_roles(role_search)
|
|
948
|
+
role_summaries: List[RoleSummary] = search_client.list_all()
|
|
949
|
+
|
|
950
|
+
if len(role_summaries) == 0:
|
|
951
|
+
print_log("No Roles to display")
|
|
952
|
+
return
|
|
953
|
+
|
|
954
|
+
role_summaries.sort(key=lambda role: role.name if role.name is not None else "")
|
|
955
|
+
|
|
956
|
+
print_log("Obtaining permissions for each role ...")
|
|
957
|
+
roles: List[Role] = [CLIENT.account_client.get_role(x.id) for x in role_summaries]
|
|
958
|
+
|
|
959
|
+
if not ARGS_PARSER.details:
|
|
960
|
+
print_numbered_object_list(CLIENT, roles, object_type_name="Role")
|
|
961
|
+
return
|
|
962
|
+
|
|
963
|
+
for selected_users in select(CLIENT, roles, object_type_name="Role"):
|
|
964
|
+
print_yd_object(selected_users)
|
|
965
|
+
|
|
966
|
+
|
|
849
967
|
def get_autoscaling_capacity(namespace: str) -> Dict:
|
|
850
968
|
"""
|
|
851
969
|
Get the current autoscaling values for a namespace.
|
{yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/args.py
RENAMED
|
@@ -627,6 +627,30 @@ class CLIParser:
|
|
|
627
627
|
required=False,
|
|
628
628
|
help="list namespace policies",
|
|
629
629
|
)
|
|
630
|
+
parser.add_argument(
|
|
631
|
+
"--users",
|
|
632
|
+
action="store_true",
|
|
633
|
+
required=False,
|
|
634
|
+
help="list users",
|
|
635
|
+
)
|
|
636
|
+
parser.add_argument(
|
|
637
|
+
"--applications",
|
|
638
|
+
action="store_true",
|
|
639
|
+
required=False,
|
|
640
|
+
help="list applications",
|
|
641
|
+
)
|
|
642
|
+
parser.add_argument(
|
|
643
|
+
"--groups",
|
|
644
|
+
action="store_true",
|
|
645
|
+
required=False,
|
|
646
|
+
help="list groups",
|
|
647
|
+
)
|
|
648
|
+
parser.add_argument(
|
|
649
|
+
"--roles",
|
|
650
|
+
action="store_true",
|
|
651
|
+
required=False,
|
|
652
|
+
help="list roles",
|
|
653
|
+
)
|
|
630
654
|
parser.add_argument(
|
|
631
655
|
"--output-file",
|
|
632
656
|
type=str,
|
|
@@ -1501,6 +1525,26 @@ class CLIParser:
|
|
|
1501
1525
|
def namespace_policies(self) -> Optional[bool]:
|
|
1502
1526
|
return self.args.namespace_policies
|
|
1503
1527
|
|
|
1528
|
+
@property
|
|
1529
|
+
@allow_missing_attribute
|
|
1530
|
+
def users(self) -> Optional[bool]:
|
|
1531
|
+
return self.args.users
|
|
1532
|
+
|
|
1533
|
+
@property
|
|
1534
|
+
@allow_missing_attribute
|
|
1535
|
+
def applications(self) -> Optional[bool]:
|
|
1536
|
+
return self.args.applications
|
|
1537
|
+
|
|
1538
|
+
@property
|
|
1539
|
+
@allow_missing_attribute
|
|
1540
|
+
def groups(self) -> Optional[bool]:
|
|
1541
|
+
return self.args.groups
|
|
1542
|
+
|
|
1543
|
+
@property
|
|
1544
|
+
@allow_missing_attribute
|
|
1545
|
+
def roles(self) -> Optional[bool]:
|
|
1546
|
+
return self.args.roles
|
|
1547
|
+
|
|
1504
1548
|
@property
|
|
1505
1549
|
@allow_missing_attribute
|
|
1506
1550
|
def show_keyring_passwords(self) -> Optional[bool]:
|
{yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/items.py
RENAMED
|
@@ -6,11 +6,13 @@ from typing import TypeVar
|
|
|
6
6
|
|
|
7
7
|
from yellowdog_client.model import (
|
|
8
8
|
Allowance,
|
|
9
|
+
Application,
|
|
9
10
|
ComputeRequirement,
|
|
10
11
|
ComputeRequirementTemplateSummary,
|
|
11
12
|
ComputeSourceTemplate,
|
|
12
13
|
ComputeSourceTemplateSummary,
|
|
13
14
|
ConfiguredWorkerPool,
|
|
15
|
+
Group,
|
|
14
16
|
Instance,
|
|
15
17
|
KeyringSummary,
|
|
16
18
|
MachineImageFamilySummary,
|
|
@@ -19,8 +21,10 @@ from yellowdog_client.model import (
|
|
|
19
21
|
Node,
|
|
20
22
|
ObjectPath,
|
|
21
23
|
ProvisionedWorkerPool,
|
|
24
|
+
Role,
|
|
22
25
|
Task,
|
|
23
26
|
TaskGroup,
|
|
27
|
+
User,
|
|
24
28
|
Worker,
|
|
25
29
|
WorkerPoolSummary,
|
|
26
30
|
WorkRequirementSummary,
|
|
@@ -32,22 +36,26 @@ Item = TypeVar(
|
|
|
32
36
|
"Item",
|
|
33
37
|
AWSAvailabilityZone,
|
|
34
38
|
Allowance,
|
|
39
|
+
Application,
|
|
35
40
|
ComputeRequirement,
|
|
36
41
|
ComputeRequirementTemplateSummary,
|
|
37
42
|
ComputeSourceTemplate,
|
|
38
43
|
ComputeSourceTemplateSummary,
|
|
39
44
|
ConfiguredWorkerPool,
|
|
45
|
+
Group,
|
|
40
46
|
Instance,
|
|
41
47
|
KeyringSummary,
|
|
42
48
|
MachineImageFamilySummary,
|
|
43
49
|
NamespacePolicy,
|
|
44
50
|
NamespaceStorageConfiguration,
|
|
51
|
+
Node,
|
|
45
52
|
ObjectPath,
|
|
46
53
|
ProvisionedWorkerPool,
|
|
54
|
+
Role,
|
|
47
55
|
Task,
|
|
48
56
|
TaskGroup,
|
|
49
|
-
|
|
57
|
+
User,
|
|
50
58
|
WorkRequirementSummary,
|
|
59
|
+
Worker,
|
|
51
60
|
WorkerPoolSummary,
|
|
52
|
-
Node,
|
|
53
61
|
)
|
|
@@ -21,6 +21,7 @@ from yellowdog_client import PlatformClient
|
|
|
21
21
|
from yellowdog_client.common.json import Json
|
|
22
22
|
from yellowdog_client.model import (
|
|
23
23
|
Allowance,
|
|
24
|
+
Application,
|
|
24
25
|
BestComputeSourceReport,
|
|
25
26
|
BestComputeSourceReportSource,
|
|
26
27
|
ComputeRequirement,
|
|
@@ -30,7 +31,10 @@ from yellowdog_client.model import (
|
|
|
30
31
|
ComputeRequirementTemplateUsage,
|
|
31
32
|
ComputeSourceTemplateSummary,
|
|
32
33
|
ConfiguredWorkerPool,
|
|
34
|
+
ExternalUser,
|
|
35
|
+
Group,
|
|
33
36
|
Instance,
|
|
37
|
+
InternalUser,
|
|
34
38
|
KeyringSummary,
|
|
35
39
|
MachineImageFamilySummary,
|
|
36
40
|
NamespacePolicy,
|
|
@@ -39,8 +43,10 @@ from yellowdog_client.model import (
|
|
|
39
43
|
ObjectPath,
|
|
40
44
|
ProvisionedWorkerPool,
|
|
41
45
|
ProvisionedWorkerPoolProperties,
|
|
46
|
+
Role,
|
|
42
47
|
Task,
|
|
43
48
|
TaskGroup,
|
|
49
|
+
User,
|
|
44
50
|
Worker,
|
|
45
51
|
WorkerPoolSummary,
|
|
46
52
|
WorkRequirement,
|
|
@@ -62,6 +68,7 @@ from yellowdog_cli.utils.settings import (
|
|
|
62
68
|
HIGHLIGHTED_STATES,
|
|
63
69
|
JSON_INDENT,
|
|
64
70
|
MAX_LINES_COLOURED_FORMATTING,
|
|
71
|
+
MAX_TABLE_DESCRIPTION,
|
|
65
72
|
NAMESPACE_OBJECT_STORE_PREFIX_SEPARATOR,
|
|
66
73
|
PROP_RESOURCE,
|
|
67
74
|
WARNING_STYLE,
|
|
@@ -395,6 +402,7 @@ def compute_requirement_template_table(
|
|
|
395
402
|
"Name",
|
|
396
403
|
"Namespace",
|
|
397
404
|
"Type",
|
|
405
|
+
"Description",
|
|
398
406
|
"Strategy Type",
|
|
399
407
|
"Compute Requirement Template ID",
|
|
400
408
|
]
|
|
@@ -416,6 +424,7 @@ def compute_requirement_template_table(
|
|
|
416
424
|
crt_summary.name,
|
|
417
425
|
crt_summary.namespace,
|
|
418
426
|
type,
|
|
427
|
+
_truncate_text(crt_summary.description),
|
|
419
428
|
strategy_type,
|
|
420
429
|
crt_summary.id,
|
|
421
430
|
]
|
|
@@ -430,6 +439,7 @@ def compute_source_template_table(
|
|
|
430
439
|
"#",
|
|
431
440
|
"Name",
|
|
432
441
|
"Namespace",
|
|
442
|
+
"Description",
|
|
433
443
|
"Provider",
|
|
434
444
|
"Type",
|
|
435
445
|
"Compute Source Template ID",
|
|
@@ -449,6 +459,7 @@ def compute_source_template_table(
|
|
|
449
459
|
index + 1,
|
|
450
460
|
cst_summary.name,
|
|
451
461
|
cst_summary.namespace,
|
|
462
|
+
_truncate_text(cst_summary.description),
|
|
452
463
|
provider,
|
|
453
464
|
type,
|
|
454
465
|
cst_summary.id,
|
|
@@ -472,7 +483,7 @@ def keyring_table(
|
|
|
472
483
|
[
|
|
473
484
|
index + 1,
|
|
474
485
|
keyring.name,
|
|
475
|
-
keyring.description,
|
|
486
|
+
_truncate_text(keyring.description),
|
|
476
487
|
keyring.id,
|
|
477
488
|
]
|
|
478
489
|
)
|
|
@@ -628,7 +639,7 @@ def allowances_table(
|
|
|
628
639
|
[
|
|
629
640
|
index + 1,
|
|
630
641
|
allowance.type.split(".")[-1],
|
|
631
|
-
allowance.description,
|
|
642
|
+
_truncate_text(allowance.description),
|
|
632
643
|
allowance.allowedHours,
|
|
633
644
|
allowance.remainingHours,
|
|
634
645
|
allowance.limitEnforcement,
|
|
@@ -661,7 +672,7 @@ def attribute_definitions_table(
|
|
|
661
672
|
attribute_definition["name"],
|
|
662
673
|
attribute_definition["type"].split(".")[-1],
|
|
663
674
|
attribute_definition["title"],
|
|
664
|
-
attribute_definition.get("description", ""),
|
|
675
|
+
_truncate_text(attribute_definition.get("description", "")),
|
|
665
676
|
]
|
|
666
677
|
)
|
|
667
678
|
return headers, table
|
|
@@ -709,6 +720,115 @@ def namespace_policies_table(
|
|
|
709
720
|
return headers, table
|
|
710
721
|
|
|
711
722
|
|
|
723
|
+
def users_table(
|
|
724
|
+
users: List[User],
|
|
725
|
+
) -> (List[str], List[List]):
|
|
726
|
+
headers = [
|
|
727
|
+
"#",
|
|
728
|
+
"Name",
|
|
729
|
+
"User Type",
|
|
730
|
+
"Username",
|
|
731
|
+
"Email",
|
|
732
|
+
"ID",
|
|
733
|
+
]
|
|
734
|
+
table = []
|
|
735
|
+
for index, user in enumerate(users):
|
|
736
|
+
if isinstance(user, InternalUser):
|
|
737
|
+
table.append(
|
|
738
|
+
[
|
|
739
|
+
index + 1,
|
|
740
|
+
user.name,
|
|
741
|
+
"Internal",
|
|
742
|
+
user.username,
|
|
743
|
+
user.email,
|
|
744
|
+
user.id,
|
|
745
|
+
]
|
|
746
|
+
)
|
|
747
|
+
elif isinstance(user, ExternalUser): # External user
|
|
748
|
+
table.append(
|
|
749
|
+
[
|
|
750
|
+
index + 1,
|
|
751
|
+
user.name,
|
|
752
|
+
"External",
|
|
753
|
+
"",
|
|
754
|
+
user.email,
|
|
755
|
+
user.id,
|
|
756
|
+
]
|
|
757
|
+
)
|
|
758
|
+
return headers, table
|
|
759
|
+
|
|
760
|
+
|
|
761
|
+
def applications_table(
|
|
762
|
+
applications: List[Application],
|
|
763
|
+
) -> (List[str], List[List]):
|
|
764
|
+
headers = [
|
|
765
|
+
"#",
|
|
766
|
+
"Name",
|
|
767
|
+
"Description",
|
|
768
|
+
"ID",
|
|
769
|
+
]
|
|
770
|
+
table = []
|
|
771
|
+
for index, application in enumerate(applications):
|
|
772
|
+
table.append(
|
|
773
|
+
[
|
|
774
|
+
index + 1,
|
|
775
|
+
application.name,
|
|
776
|
+
_truncate_text(application.description),
|
|
777
|
+
application.id,
|
|
778
|
+
]
|
|
779
|
+
)
|
|
780
|
+
return headers, table
|
|
781
|
+
|
|
782
|
+
|
|
783
|
+
def groups_table(
|
|
784
|
+
groups: List[Group],
|
|
785
|
+
) -> (List[str], List[List]):
|
|
786
|
+
headers = [
|
|
787
|
+
"#",
|
|
788
|
+
"Name",
|
|
789
|
+
"Admin Group?",
|
|
790
|
+
"Description",
|
|
791
|
+
"Roles",
|
|
792
|
+
"ID",
|
|
793
|
+
]
|
|
794
|
+
table = []
|
|
795
|
+
for index, group in enumerate(groups):
|
|
796
|
+
table.append(
|
|
797
|
+
[
|
|
798
|
+
index + 1,
|
|
799
|
+
group.name,
|
|
800
|
+
group.adminGroup,
|
|
801
|
+
_truncate_text(group.description),
|
|
802
|
+
", ".join([x.role.name for x in group.roles]),
|
|
803
|
+
group.id,
|
|
804
|
+
]
|
|
805
|
+
)
|
|
806
|
+
return headers, table
|
|
807
|
+
|
|
808
|
+
|
|
809
|
+
def roles_table(
|
|
810
|
+
roles: List[Role],
|
|
811
|
+
) -> (List[str], List[List]):
|
|
812
|
+
headers = [
|
|
813
|
+
"#",
|
|
814
|
+
"Name",
|
|
815
|
+
"Permissions",
|
|
816
|
+
"ID",
|
|
817
|
+
]
|
|
818
|
+
table = []
|
|
819
|
+
for index, role in enumerate(roles):
|
|
820
|
+
permissions = ", ".join(sorted([x.value for x in role.permissions]))
|
|
821
|
+
table.append(
|
|
822
|
+
[
|
|
823
|
+
index + 1,
|
|
824
|
+
role.name,
|
|
825
|
+
_truncate_text(permissions),
|
|
826
|
+
role.id,
|
|
827
|
+
]
|
|
828
|
+
)
|
|
829
|
+
return headers, table
|
|
830
|
+
|
|
831
|
+
|
|
712
832
|
def print_numbered_object_list(
|
|
713
833
|
client: PlatformClient,
|
|
714
834
|
objects: List[Union[Item, str, Dict]],
|
|
@@ -769,6 +889,14 @@ def print_numbered_object_list(
|
|
|
769
889
|
headers, table = nodes_table(objects)
|
|
770
890
|
elif isinstance(objects[0], Worker):
|
|
771
891
|
headers, table = workers_table(objects)
|
|
892
|
+
elif isinstance(objects[0], User):
|
|
893
|
+
headers, table = users_table(objects)
|
|
894
|
+
elif isinstance(objects[0], Application):
|
|
895
|
+
headers, table = applications_table(objects)
|
|
896
|
+
elif isinstance(objects[0], Group):
|
|
897
|
+
headers, table = groups_table(objects)
|
|
898
|
+
elif isinstance(objects[0], Role):
|
|
899
|
+
headers, table = roles_table(objects)
|
|
772
900
|
else:
|
|
773
901
|
table = []
|
|
774
902
|
for index, obj in enumerate(objects):
|
|
@@ -1322,3 +1450,13 @@ def _print_to_file(json_string: str, output_file: str, with_final_comma: bool =
|
|
|
1322
1450
|
raise Exception(f"Cannot open output file for writing: {e}")
|
|
1323
1451
|
|
|
1324
1452
|
FIRST_OUTPUT_TO_FILE = False
|
|
1453
|
+
|
|
1454
|
+
|
|
1455
|
+
def _truncate_text(description: Union[str, None]):
|
|
1456
|
+
"""
|
|
1457
|
+
Truncate a description to fit within MAX_TABLE_DESCRIPTION.
|
|
1458
|
+
"""
|
|
1459
|
+
if description is None:
|
|
1460
|
+
return ""
|
|
1461
|
+
|
|
1462
|
+
return f"{description[:MAX_TABLE_DESCRIPTION - 3] + '...' if len(description) > MAX_TABLE_DESCRIPTION else description}"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: yellowdog-python-examples
|
|
3
|
-
Version: 7.16.
|
|
3
|
+
Version: 7.16.6
|
|
4
4
|
Summary: Python CLI commands using the YellowDog Python SDK
|
|
5
5
|
Author-email: YellowDog Limited <support@yellowdog.co>
|
|
6
6
|
Project-URL: Homepage, https://github.com/yellowdog/python-examples
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "7.16.4"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/tests/test_create_remove.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/tests/test_entrypoints.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/abort.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/admin.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/boost.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/cancel.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/cloudwizard.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/compare.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/delete.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/download.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/follow.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/format_json.py
RENAMED
|
File without changes
|
|
File without changes
|
{yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/instantiate.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/jsonnet2json.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/provision.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/remove.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/resize.py
RENAMED
|
File without changes
|
|
File without changes
|
{yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/shutdown.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/start.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/terminate.py
RENAMED
|
File without changes
|
{yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/upload.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/utils/wrapper.py
RENAMED
|
File without changes
|
|
File without changes
|
{yellowdog_python_examples-7.16.4 → yellowdog_python_examples-7.16.6}/yellowdog_cli/version.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|