update method
Updates an existing user in a Cloud SQL instance.
request - The metadata request object.
Request parameters:
project - Project ID of the project that contains the instance.
instance - Database instance ID. This does not include the project ID.
databaseRoles - Optional. List of database roles to grant to the user.
body.database_roles will be ignored for update request.
host - Optional. Host of the user in the instance.
location - Optional. Region of the Cloud SQL instance.
name - Name of the user in the instance.
revokeExistingRoles - Optional. Specifies whether to revoke existing
roles that are not present in the database_roles field. If false or
unset, the database roles specified in database_roles are added to the
user's existing roles.
revokeExistingServerRoles - Optional. Specifies whether to revoke
existing roles that are not present in the server_roles field. If
false or unset, the server roles specified in server_roles are added
to the user's existing server roles.
serverRoles - Optional. The server roles to grant to the SQL Server
login. Existing server roles will not be revoked if revoke_existing_roles
is false. body.server_roles will be ignored for update request.
$fields - Selector specifying which fields to include in a partial
response.
Completes with a Operation.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<Operation> update(
User request,
core.String project,
core.String instance, {
core.List<core.String>? databaseRoles,
core.String? host,
core.String? location,
core.String? name,
core.bool? revokeExistingRoles,
core.bool? revokeExistingServerRoles,
core.List<core.String>? serverRoles,
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
'databaseRoles': ?databaseRoles,
'host': ?host == null ? null : [host],
'location': ?location == null ? null : [location],
'name': ?name == null ? null : [name],
'revokeExistingRoles': ?revokeExistingRoles == null
? null
: ['${revokeExistingRoles}'],
'revokeExistingServerRoles': ?revokeExistingServerRoles == null
? null
: ['${revokeExistingServerRoles}'],
'serverRoles': ?serverRoles,
'fields': ?$fields == null ? null : [$fields],
};
final url_ =
'v1/projects/' +
commons.escapeVariable('$project') +
'/instances/' +
commons.escapeVariable('$instance') +
'/users';
final response_ = await _requester.request(
url_,
'PUT',
body: body_,
queryParams: queryParams_,
);
return Operation.fromJson(response_ as core.Map<core.String, core.dynamic>);
}