Managed Service for PostgreSQL API, REST: User.GrantPermission
Grants permission to the specified PostgreSQL user.
HTTP request
POST https://mdb.api.cloud.yandex.net/managed-postgresql/v1/clusters/{clusterId}/users/{userName}:grantPermission
Path parameters
Field |
Description |
clusterId |
string Required field. ID of the PostgreSQL cluster the user belongs to. |
userName |
string Required field. Name of the user to grant the permission to. |
Body parameters
{
"permission": {
"databaseName": "string"
}
}
Field |
Description |
permission |
Required field. Permission that should be granted to the specified user. |
Permission
Field |
Description |
databaseName |
string Name of the database that the permission grants access to. |
Response
HTTP Code: 200 - OK
{
"id": "string",
"description": "string",
"createdAt": "string",
"createdBy": "string",
"modifiedAt": "string",
"done": "boolean",
"metadata": {
"clusterId": "string",
"userName": "string"
},
// Includes only one of the fields `error`, `response`
"error": {
"code": "integer",
"message": "string",
"details": [
"object"
]
},
"response": {
"name": "string",
"clusterId": "string",
"permissions": [
{
"databaseName": "string"
}
],
"connLimit": "string",
"settings": {
"defaultTransactionIsolation": "string",
"lockTimeout": "string",
"logMinDurationStatement": "string",
"synchronousCommit": "string",
"tempFileLimit": "string",
"logStatement": "string",
"poolMode": "string",
"preparedStatementsPooling": "boolean",
"catchupTimeout": "string",
"walSenderTimeout": "string",
"idleInTransactionSessionTimeout": "string",
"statementTimeout": "string",
"pgaudit": {
"log": [
"string"
]
}
},
"login": "boolean",
"grants": [
"string"
],
"deletionProtection": "boolean",
"userPasswordEncryption": "string"
}
// end of the list of possible fields
}
An Operation resource. For more information, see Operation.
Field |
Description |
id |
string ID of the operation. |
description |
string Description of the operation. 0-256 characters long. |
createdAt |
string (date-time) Creation timestamp. String in RFC3339 To work with values in this field, use the APIs described in the |
createdBy |
string ID of the user or service account who initiated the operation. |
modifiedAt |
string (date-time) The time when the Operation resource was last modified. String in RFC3339 To work with values in this field, use the APIs described in the |
done |
boolean If the value is |
metadata |
Service-specific metadata associated with the operation. |
error |
The error result of the operation in case of failure or cancellation. Includes only one of the fields The operation result. |
response |
The normal response of the operation in case of success. Includes only one of the fields The operation result. |
GrantUserPermissionMetadata
Field |
Description |
clusterId |
string ID of the PostgreSQL cluster the user belongs to. |
userName |
string Name of the user that is being granted a permission. |
Status
The error result of the operation in case of failure or cancellation.
Field |
Description |
code |
integer (int32) Error code. An enum value of google.rpc.Code |
message |
string An error message. |
details[] |
object A list of messages that carry the error details. |
User
A PostgreSQL User resource. For more information, see
the Developer's Guide.
Field |
Description |
name |
string Name of the PostgreSQL user. |
clusterId |
string ID of the PostgreSQL cluster the user belongs to. |
permissions[] |
Set of permissions granted to the user to access specific databases. |
connLimit |
string (int64) Maximum number of database connections available to the user. When used in session pooling, this setting limits the number of connections to every single host in PostgreSQL cluster. In this case, the setting's value must be greater than the total number of connections that backend services can open to access the PostgreSQL cluster. The setting's value should not exceed the value of the When used in transaction pooling, this setting limits the number of user's active transactions; therefore, in this mode user can open thousands of connections, but only Minimum value: |
settings |
|
login |
boolean This flag defines whether the user can login to a PostgreSQL database. Default value: |
grants[] |
string A set of roles and privileges that are granted to the user. For more information, see the documentation. |
deletionProtection |
boolean Determines whether the user deletion protection is enabled. The default value is |
userPasswordEncryption |
enum (UserPasswordEncryption) Password-based authentication method for user.
|
Permission
Field |
Description |
databaseName |
string Name of the database that the permission grants access to. |
UserSettings
PostgreSQL user settings.
Field |
Description |
defaultTransactionIsolation |
enum (TransactionIsolation) SQL sets an isolation level for each transaction. For more information, see the PostgreSQL documentation
|
lockTimeout |
string (int64) The maximum time (in milliseconds) for any statement to wait for acquiring a lock on an table, index, row or other database object. Default value: |
logMinDurationStatement |
string (int64) This setting controls logging of the duration of statements. The duration of each completed statement will be logged if the statement ran for at least the specified amount of time (in milliseconds). Value of Value of For more information, see the PostgreSQL documentation |
synchronousCommit |
enum (SynchronousCommit) This setting defines whether DBMS will commit transaction in a synchronous way. When synchronization is enabled, cluster waits for the synchronous operations to be completed prior to reporting For more information, see the PostgreSQL documentation
|
tempFileLimit |
string (int64) The maximum storage space size (in kilobytes) that a single process can use to create temporary files. A huge query may not fit into a server's RAM, therefore PostgreSQL will use some storage to store and execute such a query. Too big queries can make excessive use of the storage system, effectively making other quieries to run slow. This setting prevents execution of a big queries that can influence other queries by limiting size of temporary files. |
logStatement |
enum (LogStatement) This setting specifies which SQL statements should be logged (on the user level). For more information, see the PostgreSQL documentation
|
poolMode |
enum (PoolingMode) Mode that the connection pooler is working in with specified user. For more information, see the Odyssey documentation
|
preparedStatementsPooling |
boolean User can use prepared statements with transaction pooling. For more information, see the PostgreSQL documentation |
catchupTimeout |
string (int64) The connection pooler setting. It determines the maximum allowed replication lag (in seconds). Default value: 0 Value of |
walSenderTimeout |
string (int64) The maximum time (in milliseconds) to wait for WAL replication (can be set only for PostgreSQL 12+) Default value: Value of For more information, see the PostgreSQL documentation |
idleInTransactionSessionTimeout |
string (int64) Sets the maximum allowed idle time, in milliseconds, between queries while in a transaction. The default value is For more information, see the PostgreSQL documentation |
statementTimeout |
string (int64) The maximum time (in milliseconds) to wait for statement. If Value of For more information, see the PostgreSQL documentation |
pgaudit |
Settings of the PostgreSQL Audit Extension |
PGAuditSettings
Field |
Description |
log[] |
enum (PGAuditSettingsLog) Defines which user queries will be written to the audit log. Corresponds to the Pg audit log user setting. The possible values are the following:
The default value is PG_AUDIT_SETTINGS_LOG_UNSPECIFIED. In this case, the parameter is not configured.
|