public interface UserApi
User
Modifier and Type | Method and Description |
---|---|
void |
create(Set<User> users)
Create database users.
|
void |
create(String userName,
String password,
String databaseName)
Create a database user by name, password, and database name.
|
void |
create(String userName,
String password,
String host,
String databaseName)
Create a database user by name, password, and database name.
|
boolean |
delete(String userName)
This operation deletes the specified user for the specified database instance.
|
User |
get(String name)
Returns a User by identifier.
|
User |
get(String name,
String hostname)
Returns a User by name and allowed host.
|
com.google.common.collect.FluentIterable<String> |
getDatabaseList(String userName)
This operation shows a list of all databases to which a user has access.
|
void |
grant(String userName,
List<String> databases)
This operation grants access for the specified user to a database for the specified instance.
|
void |
grant(String userName,
String databaseName)
This operation grants access for the specified user to a database for the specified instance.
|
com.google.common.collect.FluentIterable<User> |
list()
This operation lists the users in the specified database instance.
|
boolean |
revoke(String userName,
String databaseName)
This operation grants access for the specified user to a database for the specified instance.
|
@Named(value="user:create") @POST @Path(value="/users") @Consumes(value="application/json") void create(Set<User> users)
users
- List of users to be created.@Named(value="user:create") @POST @Path(value="/users") @Consumes(value="application/json") void create(String userName, String password, String databaseName)
#create(String, Set)
.userName
- Name of the user for the database.password
- User password for database access.databaseName
- Name of the database that the user can access.@Named(value="user:create") @POST @Path(value="/users") @Consumes(value="application/json") void create(String userName, String password, String host, String databaseName)
#create(String, Set)
.userName
- Name of the user for the database.password
- User password for database access.host
- Specifies the host from which a user is allowed to connect to the database. Possible values are a string containing an IPv4 address or "%" to allow connecting from any host. Refer to Section 3.11.1, “User Access Restriction by Host” for details. If host is not specified, it defaults to "%".databaseName
- Name of the database that the user can access.@Named(value="user:grant") @PUT @Path(value="/users/{name}/databases") @Consumes(value="application/json") void grant(@PathParam(value="name") String userName, List<String> databases)
userName
- The name of the specified user.databases
- List of the databases that the user should be granted access to.@Named(value="user:grant") @PUT @Path(value="/users/{name}/databases") @Consumes(value="application/json") void grant(@PathParam(value="name") String userName, String databaseName)
#create(String, Set)
.
The user is granted all privileges.userName
- Name of the user for the database.databaseName
- Name of the database that the user can access.@Named(value="user:revoke") @DELETE @Path(value="/users/{name}/databases/{databaseName}") @Consumes(value="application/json") boolean revoke(@PathParam(value="name") String userName, @PathParam(value="databaseName") String databaseName)
userName
- Name of the user for the database.databaseName
- Name of the database that the user can access.@Named(value="users:delete/{name}") @DELETE @Path(value="/users/{name}") @Consumes(value="application/json") boolean delete(@PathParam(value="name") String userName)
userName
- The name for the specified user.@Named(value="user:list") @GET @Path(value="/users") @Consumes(value="application/json") com.google.common.collect.FluentIterable<User> list()
@Named(value="user:getDatabaseList/{name}") @GET @Path(value="/users/{name}/databases") @Consumes(value="application/json") com.google.common.collect.FluentIterable<String> getDatabaseList(@PathParam(value="name") String userName)
instanceId
- The instance ID for the specified database instance.userName
- The name for the specified user.@Named(value="user:get/{name}") @GET @Path(value="/users/{name}") @Consumes(value="application/json") @Nullable User get(@PathParam(value="name") String name)
name
- The name or identifier for the specified user.@Named(value="user:get/{name}@{hostname}") @GET @Path(value="/users/{name}@{hostname}") @Consumes(value="application/json") @Nullable User get(@PathParam(value="name") String name, @PathParam(value="hostname") String hostname)
name
- The name for the specified user.host
- The associated hostname.Copyright © 2009-2018 The Apache Software Foundation. All Rights Reserved.