diff --git a/releasenotes/notes/datastore-specific-api-extensions-973b455a9922d072.yaml b/releasenotes/notes/datastore-specific-api-extensions-973b455a9922d072.yaml new file mode 100644 index 00000000..b5e147fc --- /dev/null +++ b/releasenotes/notes/datastore-specific-api-extensions-973b455a9922d072.yaml @@ -0,0 +1,3 @@ +--- +features: + - Support was added to manage users and databases for clusters. diff --git a/troveclient/v1/shell.py b/troveclient/v1/shell.py index c5131cc5..afdce108 100644 --- a/troveclient/v1/shell.py +++ b/troveclient/v1/shell.py @@ -1155,7 +1155,7 @@ def do_execution_delete(cs, args): @utils.service_type('database') def do_database_create(cs, args): """Creates a database on an instance.""" - instance = _find_instance(cs, args.instance) + instance, _ = _find_instance_or_cluster(cs, args.instance) database_dict = {'name': args.name} if args.collate: database_dict['collate'] = args.collate @@ -1170,7 +1170,7 @@ def do_database_create(cs, args): @utils.service_type('database') def do_database_list(cs, args): """Lists available databases on an instance.""" - instance = _find_instance(cs, args.instance) + instance, _ = _find_instance_or_cluster(cs, args.instance) items = cs.databases.list(instance) databases = items while (items.next): @@ -1186,7 +1186,7 @@ def do_database_list(cs, args): @utils.service_type('database') def do_database_delete(cs, args): """Deletes a database from an instance.""" - instance = _find_instance(cs, args.instance) + instance, _ = _find_instance_or_cluster(cs, args.instance) cs.databases.delete(instance, args.database) @@ -1204,7 +1204,7 @@ def do_database_delete(cs, args): @utils.service_type('database') def do_user_create(cs, args): """Creates a user on an instance.""" - instance = _find_instance(cs, args.instance) + instance, _ = _find_instance_or_cluster(cs, args.instance) databases = [{'name': value} for value in args.databases] user = {'name': args.name, 'password': args.password, 'databases': databases} @@ -1218,7 +1218,7 @@ def do_user_create(cs, args): @utils.service_type('database') def do_user_list(cs, args): """Lists the users for an instance.""" - instance = _find_instance(cs, args.instance) + instance, _ = _find_instance_or_cluster(cs, args.instance) items = cs.users.list(instance) users = items while (items.next): @@ -1238,7 +1238,7 @@ def do_user_list(cs, args): @utils.service_type('database') def do_user_delete(cs, args): """Deletes a user from an instance.""" - instance = _find_instance(cs, args.instance) + instance, _ = _find_instance_or_cluster(cs, args.instance) cs.users.delete(instance, args.name, hostname=args.host) @@ -1250,7 +1250,7 @@ def do_user_delete(cs, args): @utils.service_type('database') def do_user_show(cs, args): """Shows details of a user of an instance.""" - instance = _find_instance(cs, args.instance) + instance, _ = _find_instance_or_cluster(cs, args.instance) user = cs.users.get(instance, args.name, hostname=args.host) _print_object(user) @@ -1263,7 +1263,7 @@ def do_user_show(cs, args): @utils.service_type('database') def do_user_show_access(cs, args): """Shows access details of a user of an instance.""" - instance = _find_instance(cs, args.instance) + instance, _ = _find_instance_or_cluster(cs, args.instance) access = cs.users.list_access(instance, args.name, hostname=args.host) utils.print_list(access, ['name']) @@ -1284,7 +1284,7 @@ def do_user_update_attributes(cs, args): """Updates a user's attributes on an instance. At least one optional argument must be provided. """ - instance = _find_instance(cs, args.instance) + instance, _ = _find_instance_or_cluster(cs, args.instance) new_attrs = {} if args.new_name: new_attrs['name'] = args.new_name @@ -1307,7 +1307,7 @@ def do_user_update_attributes(cs, args): @utils.service_type('database') def do_user_grant_access(cs, args): """Grants access to a database(s) for a user.""" - instance = _find_instance(cs, args.instance) + instance, _ = _find_instance_or_cluster(cs, args.instance) cs.users.grant(instance, args.name, args.databases, hostname=args.host) @@ -1321,7 +1321,7 @@ def do_user_grant_access(cs, args): @utils.service_type('database') def do_user_revoke_access(cs, args): """Revokes access to a database for a user.""" - instance = _find_instance(cs, args.instance) + instance, _ = _find_instance_or_cluster(cs, args.instance) cs.users.revoke(instance, args.name, args.database, hostname=args.host)