Skip to content

Commit

Permalink
Added roles
Browse files Browse the repository at this point in the history
  • Loading branch information
augustak committed Aug 23, 2023
1 parent c28f7f3 commit ac4b118
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lascli/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
create_payment_methods_parser,
create_plans_parser,
create_predictions_parser,
create_roles_parser,
create_secrets_parser,
create_transitions_parser,
create_users_parser,
Expand Down Expand Up @@ -57,6 +58,7 @@ def create_parser():
create_payment_methods_parser(subparsers)
create_plans_parser(subparsers)
create_predictions_parser(subparsers)
create_roles_parser(subparsers)
create_secrets_parser(subparsers)
create_transitions_parser(subparsers)
create_users_parser(subparsers)
Expand Down
2 changes: 1 addition & 1 deletion lascli/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
__maintainer_email__ = 'magnus@lucidtech.ai'
__title__ = 'lucidtech-las-cli'
__url__ = 'https://github.com/LucidtechAI/las-cli'
__version__ = '10.1.0'
__version__ = '10.2.0'
1 change: 1 addition & 0 deletions lascli/parser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from .payment_methods import create_payment_methods_parser
from .plans import create_plans_parser
from .predictions import create_predictions_parser
from .roles import create_roles_parser
from .secrets import create_secrets_parser
from .transitions import create_transitions_parser
from .users import create_users_parser
Expand Down
2 changes: 2 additions & 0 deletions lascli/parser/app_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def create_app_clients_parser(subparsers):
create_app_client_parser.add_argument('--callback-urls', nargs='+')
create_app_client_parser.add_argument('--login-urls', nargs='+')
create_app_client_parser.add_argument('--default-login-url')
create_app_client_parser.add_argument('--role-ids', nargs='+')
create_app_client_parser.set_defaults(cmd=create_app_client)

list_app_clients_parser = subparsers.add_parser('list')
Expand All @@ -57,6 +58,7 @@ def create_app_clients_parser(subparsers):
update_app_client_parser.add_argument('app_client_id')
update_app_client_parser.add_argument('--name', type=nullable(str), default=NotProvided)
update_app_client_parser.add_argument('--description', type=nullable(str), default=NotProvided)
update_app_client_parser.add_argument('--role-ids', nargs='+')
update_app_client_parser.set_defaults(cmd=update_app_client)

delete_app_client_parser = subparsers.add_parser('delete')
Expand Down
25 changes: 25 additions & 0 deletions lascli/parser/roles.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from datetime import datetime
from las import Client


def list_roles(las_client: Client, **optional_args):
return las_client.list_roles(**optional_args)


def get_role(las_client: Client, role_id):
return las_client.get_role(role_id)


def create_roles_parser(subparsers):
parser = subparsers.add_parser('roles')
subparsers = parser.add_subparsers()

get_role_parser = subparsers.add_parser('get')
get_role_parser.add_argument('role_id')
get_role_parser.set_defaults(cmd=get_role)

list_roles_parser = subparsers.add_parser('list')
list_roles_parser.add_argument('--max-results', '-m', type=int, default=None)
list_roles_parser.add_argument('--next-token', '-n', type=str, default=None)
list_roles_parser.set_defaults(cmd=list_roles)
return parser
2 changes: 2 additions & 0 deletions lascli/parser/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def create_users_parser(subparsers):
create_user_parser.add_argument('app_client_id')
create_user_parser.add_argument('--name')
create_user_parser.add_argument('--avatar', help='Path to avatar JPEG image.')
create_user_parser.add_argument('--role-ids', nargs='+')
create_user_parser.set_defaults(cmd=create_user)

update_user_parser = subparsers.add_parser('update')
Expand All @@ -58,6 +59,7 @@ def create_users_parser(subparsers):
type=nullable(str),
default=NotProvided
)
update_user_parser.add_argument('--role-ids', nargs='+')
update_user_parser.set_defaults(cmd=update_user)

list_users_parser = subparsers.add_parser('list')
Expand Down

0 comments on commit ac4b118

Please sign in to comment.