# Google Cloud Sql Admin V1 Client - Class User (1.9.0)

1.9.0 (latest) 1.8.0 1.7.0 1.6.0 1.5.0 1.4.0 1.3.1 1.2.6 1.1.0 1.0.0 0.19.0 0.18.0 0.17.1 0.16.1 0.12.0 0.11.0 0.10.0 0.9.0 0.8.0 0.7.0 0.6.0 0.5.0 0.4.1 0.3.1 0.2.12 Reference documentation and code samples for the Google Cloud Sql Admin V1 Client class User.

A Cloud SQL user resource.

Generated from protobuf message `google.cloud.sql.v1.User`

## Namespace

Google \\ Cloud \\ Sql \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ kind` | `string` This is always `sql#user`. |
| `↳ password` | `string` The password for the user. |
| `↳ etag` | `string` This field is deprecated and will be removed from a future version of the API. |
| `↳ 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. |
| `↳ 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. |
| `↳ 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. |
| `↳ type` | `int` The user type. It determines the method to authenticate the user during login. The default is the database's built-in user type. |
| `↳ sqlserver_user_details` | `https://docs.cloud.google.com/php/docs/reference/cloud-sql-admin/latest/V1.SqlServerUserDetails` |
| `↳ iam_email` | `string` Optional. The full email for an IAM user. For normal database users, this will not be filled. Only applicable to MySQL database users. |
| `↳ password_policy` | `https://docs.cloud.google.com/php/docs/reference/cloud-sql-admin/latest/V1.UserPasswordValidationPolicy` User level password validation policy. |
| `↳ dual_password_type` | `int` Dual password status for the user. |
| `↳ iam_status` | `int` Indicates if a group is active or inactive for IAM database authentication. |
| `↳ database_roles` | `string[]` Optional. Role memberships of the user |

### getKind

This is always `sql#user`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setKind

This is always `sql#user`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getPassword

The password for the user.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setPassword

The password for the user.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getEtag

This field is deprecated and will be removed from a future version of the
API.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setEtag

This field is deprecated and will be removed from a future version of the
API.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getName

The name of the user in the Cloud SQL instance. Can be omitted for
`update` because it is already specified in the URL.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

The name of the user in the Cloud SQL instance. Can be omitted for
`update` because it is already specified in the URL.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getHost

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.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setHost

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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getInstance

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.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setInstance

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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getProject

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.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setProject

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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getType

The user type. It determines the method to authenticate the user during
login. The default is the database's built-in user type.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [SqlUserType](https://docs.cloud.google.com/php/docs/reference/cloud-sql-admin/latest/V1.User.SqlUserType). |

### setType

The user type. It determines the method to authenticate the user during
login. The default is the database's built-in user type.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [SqlUserType](https://docs.cloud.google.com/php/docs/reference/cloud-sql-admin/latest/V1.User.SqlUserType). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSqlserverUserDetails

Generated from protobuf field `.google.cloud.sql.v1.SqlServerUserDetails sqlserver_user_details = 9;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-sql-admin/latest/V1.SqlServerUserDetails|null` |   |

### hasSqlserverUserDetails

### setSqlserverUserDetails

Generated from protobuf field `.google.cloud.sql.v1.SqlServerUserDetails sqlserver_user_details = 9;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-sql-admin/latest/V1.SqlServerUserDetails` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getIamEmail

Optional. The full email for an IAM user. For normal database users, this
will not be filled. Only applicable to MySQL database users.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setIamEmail

Optional. The full email for an IAM user. For normal database users, this
will not be filled. Only applicable to MySQL database users.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getPasswordPolicy

User level password validation policy.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-sql-admin/latest/V1.UserPasswordValidationPolicy|null` |   |

### hasPasswordPolicy

### clearPasswordPolicy

### setPasswordPolicy

User level password validation policy.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-sql-admin/latest/V1.UserPasswordValidationPolicy` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDualPasswordType

Dual password status for the user.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### hasDualPasswordType

### clearDualPasswordType

### setDualPasswordType

Dual password status for the user.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getIamStatus

Indicates if a group is active or inactive for IAM database authentication.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### hasIamStatus

### clearIamStatus

### setIamStatus

Indicates if a group is active or inactive for IAM database authentication.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDatabaseRoles

Optional. Role memberships of the user

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setDatabaseRoles

Optional. Role memberships of the user

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getUserDetails

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |