Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #7 from LRZ-BADW/feat-6-cloudusage
Browse files Browse the repository at this point in the history
Add CloudUsage Command
  • Loading branch information
gierens authored May 8, 2024
2 parents 0017cc3 + 5589d35 commit 6120f68
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
parse_flavor, parse_flavor_group, generate_modify_data,
parse_user, parse_project)

cmds = ['flavor', 'flavor-group']
cmds = ['flavor', 'flavor-group', 'usage']
cmds_with_sub_cmds = ['flavor', 'flavor-group']


Expand Down Expand Up @@ -305,6 +305,13 @@ def setup_parsers(main_subparsers: _SubParsersAction):
help="Aggregate the flavor usage for all filtered users",
)

# usage parser
usage_parser: ArgumentParser = main_subparsers.add_parser(
"usage",
help="Show usage of the entire cloud",
)
parsers['usage'] = usage_parser

# avoid variable not used warnings
do_nothing(flavor_group_initialize_parser)

Expand Down Expand Up @@ -468,3 +475,9 @@ def flavor_group_usage(args: Namespace):
resp = api_request('get', f'/resources/flavorgroups/usage/{params}', None,
args)
print_response(resp, args)


def usage(args: Namespace):
'''show usage of the entire cloud'''
resp = api_request('get', '/resources/usage/', None, args)
print_response(resp, args)

0 comments on commit 6120f68

Please sign in to comment.