百度智能云

All Product Document

          Relational Database Service

          Instructions for Account Management Interfaces

          Create an account

          Create an account under a given master instance

          Note

          • The instance status is “Available”, and the instance must be a master instance.
          • Not exceed the maximum account number of the instance.
          • If the instance database engine is PostgreSQL, only Super account can be created. Other account and database operations are managed through this Super account.
          • If the instance database engine is PostgreSQL, any type of account can be created.
          • If the instance database engine is SQLServer, only a Common account can be created.

          Request structure

          POST /v{version}/instance/{instanceId}/account?clientToken={clientToken}  HTTP/1.1
          HOST: rds.bj.baidubce.com
          Authorization authorization string
          
          {
              "accountName":accountName,
              "password" : password,
              "accountType" : accountType,
              "databasePrivileges": databasePrivileges,
              "desc" : desc,
              "type" : type
          }

          Request header field

          There are no other special header fields except the common header field.

          Request parameters

          Parameter Name Type Required Parameter Position Description
          version string Yes URL parameter API Version Number
          instanceId string Yes URL parameter Specified instance ID
          clientToken string Yes Query parameter Idempotent Token is an ASCII character string with a length not exceeding 64 bits.
          accountName string Yes RequestBody parameter The account name is not Reserved Key Words.
          password string Yes RequestBody parameter The account password consists of letters, numbers or underlines, with a length of 6-32 bits.
          The password requires encrypted transmission, and plaintext transmission is prohibited. For more information, see the Definition of Password Encrypted Transmission Specifications.
          accountType string No RequestBody parameter Type of ID Permission
          Common: common account,Super: super account. Default: common account Detail reference
          databasePrivileges List databasePrivilege No RequestBody parameter This item may be set for MySQL and SQL Server instance.
          desc string No RequestBody parameter Account description information
          type string No RequestBody parameter Type of Account Belonging
          OnlyMaster: account used in master instance,RdsProxy: account used in this master instance’s proxy instance. OnlyMaster account by default Detail reference

          Return header field

          No other special header fields are available, except for common header fields.

          Return parameter

          No specific parameters are returned.

          Request examples

          POST /v{version}/instance/{instanceId}/account?clientToken={clientToken} HTTP/1.1
          HOST: rds.bj.baidubce.com
          Authorization bce-auth-v1/rdsak/2016-07-03T06:13:13Z/1800/x-bce-date/{signature}
          
          {
              "accountName":"user1",
              "password" : "mypassword",
              "accountType" : "Super",
              "databasePrivileges": [{
                  "dbName": "user_photo_001",
                  "authType": "ReadOnly"
              },{
                  "dbName": "user_photo_002",
                  "authType": "ReadWrite"
              }],
              "desc" : "Account user1"
          }

          Return examples

          HTTP/1.1 200 OK
          x-bce-request-id 7869616F-7A68-6977-656E-406261696475
          Content-Type: application/json
          Content-Length: 0

          Query an account list

          Note

          • Only the designated instance’s account list can be viewed.

          Request structure

          GET /v{version}/instance/{instanceId}/account HTTP/1.1
          HOST: rds.bj.baidubce.com
          Authorization authorization string

          Request header field

          There are no other special header fields except the common header field.

          Request Parameters

          Parameter Name Type Required Parameter Position Description
          versionstring Yes URL 0API Version Number
          instanceIdstring Yes URL Parameter Instance ID

          Return header field

          No other special header fields are available, except for common header fields.

          Return parameter

          Parameter Name Type Description
          accounts List Account The array composed of Account object

          Request examples

          GET /v{version}/instance/{instanceId}/account HTTP/1.1
          HOST: rds.bj.baidubce.com
          Authorization bce-auth-v1/rdsak/2016-07-03T06:13:13Z/1800/x-bce-date/{signature}

          Return examples

          HTTP/1.1 200 OK
          x-bce-request-id 7869616F-7A68-6977-656E-406261696475
          Content-Type: application/json
          Content-Length: 567
          
          {
              "accounts"               : [{
                  "accountName"        : "user1",
                  "desc"               : "账号user1",
                  "type"               : "OnlyMaster",
                  "status"             : "Available",
                  "accountType"        : "Common",
                  "databasePrivileges" : [{
                      "dbName"         : "user_photo_001",
                      "authType"       : "ReadOnly"
                  },{
                      "dbName"         : "user_photo_002",
                      "authType"       : "ReadWrite"
                  }],
                  "type"               : "OnlyMaster",
              },{
                  "accountName"        : "user2",
                  "desc"             : "Account user2",
                  "type"               : "OnlyMaster",
                  "status"             : "Available",
                  "accountType"        : "Common",
                  "databasePrivileges" : [{
                      "dbName"         : "user_photo_002",
                      "authType"       : "ReadOnly"
                  },{
                      "dbName"         : "user_photo_003",
                      "authType"       : "ReadWrite"
                  }],
                  "type"               : "OnlyMaster",
              }]
          }

          Query specific account information

          Note

          • Get one account information (including authorization information)

          Request structure

          GET /v{version}/instance/{instanceId}/account/{accountName} HTTP/1.1
          HOST: rds.bj.baidubce.com
          Authorization authorization string

          Request header field

          There are no other special header fields except the common header field.

          Request parameters

          Parameter Name Type Required Parameter Position Description
          versionstring Yes URL 0API Version Number
          instanceIdstring Yes URL Parameter Instance ID
          accountNamestringYes URL Parameter Account Name

          Return header field

          No other special header fields are available, except for common header fields.

          Return parameter

          Parameter Name Parameter Types Parameter Descriptions
          accountName String Account name
          desc String Account description information
          status String Account status information. See Account Status.
          type String Type of Account Belonging
          OnlyMaster: account used in master instance,
          RdsProxy: account used in middleware See Account Belonging Type Sheet.
          accountType String Type of Account Privilege Super: high-privilege account, Common: common account. See Account Privilege Type Sheet.
          databasePrivileges List DatabasePrivilege The array composed of Database Privilege.

          Request examples

          GET /v1/instance/r-ndjsndjc/account/user1 HTTP/1.1
          HOST: rds.bj.baidubce.com
          Authorization bce-auth-v1/rdsak/2016-07-03T06:13:13Z/1800/x-bce-date/{signature}

          Return examples

          HTTP/1.1 200 OK
          x-bce-request-id 7869616F-7A68-6977-656E-406261696475
          Content-Type: application/json
          ETag:v2
          Content-Length: 567
          
          {
              "accountName"   : "user1",
              "desc"          : "Account user1",
              "type"          : "OnlyMaster",
              "status"        : "Available",
              "accountType"   : "Common",
              "databasePrivileges": [{
                  "dbName"    : "user_photo_001",
                  "authType"  : "ReadOnly"
              },{
                  "dbName"    : "user_photo_002",
                  "authType"  : "ReadWrite"
              }]
          }
          Previous
          Instructions for Backup Management Interfaces
          Next
          Calling Instructions