users
Creates, updates, deletes, gets or lists a users
resource.
Overview
Name | users |
Type | Resource |
Id | google.sqladmin.users |
Fields
The following fields are returned by SELECT
queries:
- get
- list
Successful response
Name | Datatype | Description |
---|---|---|
name | string | The name of the user in the Cloud SQL instance. Can be omitted for update because it is already specified in the URL. |
dualPasswordType | string | Dual password status for the user. |
etag | string | This field is deprecated and will be removed from a future version of the API. |
host | string | Optional. The host from which the user can connect. For insert operations, host defaults to an empty string. For update operations, host is specified as part of the request URL. The host name cannot be updated after insertion. For a MySQL instance, it's required; for a PostgreSQL or SQL Server instance, it's optional. |
instance | string | The name of the Cloud SQL instance. This does not include the project ID. Can be omitted for update because it is already specified on the URL. |
kind | string | This is always sql#user . |
password | string | The password for the user. |
passwordPolicy | object | User level password validation policy. (id: UserPasswordValidationPolicy) |
project | string | The project ID of the project containing the Cloud SQL database. The Google apps domain is prefixed if applicable. Can be omitted for update because it is already specified on the URL. |
sqlserverUserDetails | object | Represents a Sql Server user on the Cloud SQL instance. (id: SqlServerUserDetails) |
type | string | The user type. It determines the method to authenticate the user during login. The default is the database's built-in user type. |
Successful response
Name | Datatype | Description |
---|---|---|
name | string | The name of the user in the Cloud SQL instance. Can be omitted for update because it is already specified in the URL. |
dualPasswordType | string | Dual password status for the user. |
etag | string | This field is deprecated and will be removed from a future version of the API. |
host | string | Optional. The host from which the user can connect. For insert operations, host defaults to an empty string. For update operations, host is specified as part of the request URL. The host name cannot be updated after insertion. For a MySQL instance, it's required; for a PostgreSQL or SQL Server instance, it's optional. |
instance | string | The name of the Cloud SQL instance. This does not include the project ID. Can be omitted for update because it is already specified on the URL. |
kind | string | This is always sql#user . |
password | string | The password for the user. |
passwordPolicy | object | User level password validation policy. (id: UserPasswordValidationPolicy) |
project | string | The project ID of the project containing the Cloud SQL database. The Google apps domain is prefixed if applicable. Can be omitted for update because it is already specified on the URL. |
sqlserverUserDetails | object | Represents a Sql Server user on the Cloud SQL instance. (id: SqlServerUserDetails) |
type | string | The user type. It determines the method to authenticate the user during login. The default is the database's built-in user type. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get | select | project , instance , name | host | Retrieves a resource containing information about a user. |
list | select | project , instance | Lists users in the specified Cloud SQL instance. | |
insert | insert | project , instance | Creates a new user in a Cloud SQL instance. | |
update | replace | project , instance | host , name | Updates an existing user in a Cloud SQL instance. |
delete | delete | project , instance | host , name | Deletes a user from a Cloud SQL instance. |
Parameters
Parameters can be passed in the WHERE
clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
Name | Datatype | Description |
---|---|---|
instance | string | |
name | string | |
project | string | |
host | string | |
name | string |
SELECT
examples
- get
- list
Retrieves a resource containing information about a user.
SELECT
name,
dualPasswordType,
etag,
host,
instance,
kind,
password,
passwordPolicy,
project,
sqlserverUserDetails,
type
FROM google.sqladmin.users
WHERE project = '{{ project }}' -- required
AND instance = '{{ instance }}' -- required
AND name = '{{ name }}' -- required
AND host = '{{ host }}';
Lists users in the specified Cloud SQL instance.
SELECT
name,
dualPasswordType,
etag,
host,
instance,
kind,
password,
passwordPolicy,
project,
sqlserverUserDetails,
type
FROM google.sqladmin.users
WHERE project = '{{ project }}' -- required
AND instance = '{{ instance }}' -- required;
INSERT
examples
- insert
- Manifest
Creates a new user in a Cloud SQL instance.
INSERT INTO google.sqladmin.users (
data__kind,
data__password,
data__etag,
data__name,
data__host,
data__instance,
data__project,
data__type,
data__sqlserverUserDetails,
data__passwordPolicy,
data__dualPasswordType,
project,
instance
)
SELECT
'{{ kind }}',
'{{ password }}',
'{{ etag }}',
'{{ name }}',
'{{ host }}',
'{{ instance }}',
'{{ project }}',
'{{ type }}',
'{{ sqlserverUserDetails }}',
'{{ passwordPolicy }}',
'{{ dualPasswordType }}',
'{{ project }}',
'{{ instance }}'
RETURNING
name,
acquireSsrsLeaseContext,
apiWarning,
backupContext,
endTime,
error,
exportContext,
importContext,
insertTime,
kind,
operationType,
selfLink,
startTime,
status,
subOperationType,
targetId,
targetLink,
targetProject,
user
;
# Description fields are for documentation purposes
- name: users
props:
- name: project
value: string
description: Required parameter for the users resource.
- name: instance
value: string
description: Required parameter for the users resource.
- name: kind
value: string
description: >
This is always `sql#user`.
- name: password
value: string
description: >
The password for the user.
- name: etag
value: string
description: >
This field is deprecated and will be removed from a future version of the API.
- name: name
value: string
description: >
The name of the user in the Cloud SQL instance. Can be omitted for `update` because it is already specified in the URL.
- name: host
value: string
description: >
Optional. The host from which the user can connect. For `insert` operations, host defaults to an empty string. For `update` operations, host is specified as part of the request URL. The host name cannot be updated after insertion. For a MySQL instance, it's required; for a PostgreSQL or SQL Server instance, it's optional.
- name: instance
value: string
description: >
The name of the Cloud SQL instance. This does not include the project ID. Can be omitted for `update` because it is already specified on the URL.
- name: project
value: string
description: >
The project ID of the project containing the Cloud SQL database. The Google apps domain is prefixed if applicable. Can be omitted for `update` because it is already specified on the URL.
- name: type
value: string
description: >
The user type. It determines the method to authenticate the user during login. The default is the database's built-in user type.
valid_values: ['BUILT_IN', 'CLOUD_IAM_USER', 'CLOUD_IAM_SERVICE_ACCOUNT', 'CLOUD_IAM_GROUP', 'CLOUD_IAM_GROUP_USER', 'CLOUD_IAM_GROUP_SERVICE_ACCOUNT']
- name: sqlserverUserDetails
value: object
description: >
Represents a Sql Server user on the Cloud SQL instance.
- name: passwordPolicy
value: object
description: >
User level password validation policy.
- name: dualPasswordType
value: string
description: >
Dual password status for the user.
valid_values: ['DUAL_PASSWORD_TYPE_UNSPECIFIED', 'NO_MODIFY_DUAL_PASSWORD', 'NO_DUAL_PASSWORD', 'DUAL_PASSWORD']
REPLACE
examples
- update
Updates an existing user in a Cloud SQL instance.
REPLACE google.sqladmin.users
SET
data__kind = '{{ kind }}',
data__password = '{{ password }}',
data__etag = '{{ etag }}',
data__name = '{{ name }}',
data__host = '{{ host }}',
data__instance = '{{ instance }}',
data__project = '{{ project }}',
data__type = '{{ type }}',
data__sqlserverUserDetails = '{{ sqlserverUserDetails }}',
data__passwordPolicy = '{{ passwordPolicy }}',
data__dualPasswordType = '{{ dualPasswordType }}'
WHERE
project = '{{ project }}' --required
AND instance = '{{ instance }}' --required
AND host = '{{ host}}'
AND name = '{{ name}}'
RETURNING
name,
acquireSsrsLeaseContext,
apiWarning,
backupContext,
endTime,
error,
exportContext,
importContext,
insertTime,
kind,
operationType,
selfLink,
startTime,
status,
subOperationType,
targetId,
targetLink,
targetProject,
user;
DELETE
examples
- delete
Deletes a user from a Cloud SQL instance.
DELETE FROM google.sqladmin.users
WHERE project = '{{ project }}' --required
AND instance = '{{ instance }}' --required
AND host = '{{ host }}'
AND name = '{{ name }}';