百度智能云

All Product Document

          Distributed Relational Database Service DRDS

          Instructions for Account Management Interfaces

          Create an Account

          Interface Description

          This interface is used to create a database account under a DRDS instance.

          Request structure

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

          Request Header Field

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

          Request parameters

          Parameter Name

          Parameter Name Type Description
          dbName String Database name
          authType String Authorization type: ReadOnly and ReadWrite, Account Privileges

          Response header field

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

          Response parameter

          No special response parameter

          Request example

          POST https://drds.bj.baidubce.com/v1/instance/drds265l1gltivi/account?clientToken=159c9a5d-252a-47ea-bee8-70176e5c4d06
          Host: drds.bj.baidubce.com
          Authorization bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
          {
              "accountName": "user2",
              "password": "6af2af9b31fe977d624237938c46d670",
              "databasePrivileges": [{
                  "dbName": "dbtest",
                  "authType": "ReadWrite"
              }],
              "remark": "user1"
          }

          Response example

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

          Delete an Account

          Interface description

          This interface is used to delete a database account under a DRDS instance.

          Request structure

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

          Request header field

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

          Request parameters

          Parameter Name Type Required? Parameter Position Description
          version String Yes URI parameter API version number
          instanceId String Yes URI parameter Instance ID
          accountName String Yes URI parameter Account name

          Response header field

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

          Response parameter No special response parameter

          Request example

          DELETE https://drds.bj.baidubce.com/v1/instance/drds265l1gltivi/account/user1
          Host: drds.bj.baidubce.com
          Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de

          Response example

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

          Query account list

          Interface description

          This interface is used to query the account list under a DRDS instance.

          Request structure

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

          Request header field

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

          Request parameters

          Parameter Name Type Required? Parameter Position Description
          version String Yes URI parameter API version number
          instanceId String Yes URI parameter Instance ID

          Response header field

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

          Response parameter

          Parameter Name Type Description
          accounts List<Account> Account list

          Account

          Parameter Name Type Description
          accountName String Account name
          remark String Remarks
          status String Account status
          databasePrivileges List<DatabasePrivilege> Authorization database list information

          Request example

          GET https://drds.bj.baidubce.com/v1/instance/drds265l1gltivi/account
          Host: drds.bj.baidubce.com
          Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de

          Response example

          HTTP/1.1 200 OK
          x-bce-request-id: 7869616F-7A68-6977-656E-406261696475
          Content-Type: application/json
          {
              "account": [
                  {
                      "accountName": "user1",
                      "status": "Available",
                      "remark": "user1",
                      "databasePrivileges": [
                          {
                              "dbName": "dbtest",
                              "authType": "ReadOnly"
                          }
                      ]
                  },
                  {
                      "accountName": "user2",
                      "status": "Available",
                      "remark": "??user1",
                      "databasePrivileges": [
                          {
                              "dbName": "dbtest",
                              "authType": "ReadWrite"
                          }
                      ]
                  }
              ]
          }

          Query account details

          Interface description

          This interface is used to query the database account list under a DRDS instance.

          Request structure

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

          Request header field

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

          Request parameters

          Parameter Name Type Required? Parameter Position Description
          version String Yes URI parameter API version number
          instanceId String Yes URI parameter Instance ID
          accountName String Yes URI parameter Account name

          Response header field

          Parameter Name Type Description
          ETag String When modifying the current version number, the current ETag needs to be transferred back through the header.

          Response parameter

          Parameter Name Type Description
          accountName String Account name
          remark String Remarks
          status String Account status
          databasePrivileges List<DatabasePrivilege> Authorization database list information

          Request example

          GET https://drds.bj.baidubce.com/v1/instance/drds265l1gltivi/account/user1
          Host: drds.bj.baidubce.com
          Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de

          Response example

          HTTP/1.1 200 OK
          x-bce-request-id: 7869616F-7A68-6977-656E-406261696475
          ETag: v10
          Content-Type: application/json
          {
           
              "accountName": "user1",
              "status": "Available",
              "remark": "user1",
              "databasePrivileges": [
                  {
                      "dbName": "dbtest",
                      "authType": "ReadOnly"
                  }
              ]
          }

          Modify an Account Password

          Interface description

          This interface is used to modify the Password of a database account under a DRDS instance.

          Request structure

          PUT /v{version}/instance/{instanceId}/account/{accountName}?modifyPassword HTTP/1.1
          HOST: drds.bj.baidubce.com
          Authorization: authorization string
          {
              "password": password
          }

          Request header field

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

          Request parameters

          Parameter Name Type Required? Parameter Position Description
          version String Yes URI parameter API version number
          instanceId String Yes URI parameter Instance ID
          accountName String Yes URI parameter Account name
          password String Yes RequestBody parameter The account password consists of any two of letters, numbers, and special characters (! @ # $% ^ _)at least , and is a length of 8-32 characters. The password needs to be encrypted for transmission. Transmitting the password in the form of plaintext is prohibited. For more information, see the Definition of Specifications for Encrypted Transmission of Password.

          Response header field

          Parameter Name Type Description
          ETag String When modifying the current version number, the current ETag needs to be transferred back through the header.

          Response parameter

          Parameter Name Type Description
          accountName String Account name
          remark String Remarks
          status String Account status
          databasePrivileges List<DatabasePrivilege> Authorization database list information

          Request example

          PUT https://drds.bj.baidubce.com/v1/instance/drds265l1gltivi/account/user1?modifyPassword
          Host: drds.bj.baidubce.com
          Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
          {
              "password": "6af2af9b31fe977d624237938c46d670"
          }

          Response example

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

          Account modification privileges

          Interface description

          This interface is used to modify the privileges of a database account under a DRDS instance.

          Request structure

          PUT /v{version}/instance/{instanceId}/account/{accountName}?modifyPrivilege HTTP/1.1
          HOST: drds.bj.baidubce.com
          x-bce-if-match:{ETag}
          Authorization: authorization string
          {
              "databasePrivileges": databasePrivileges
          }

          Request header field

          Parameter Name Type Description
          x-bce-if-match String ETag value obtained through the account details interface

          Request parameters

          Parameter Name Type Required? Parameter Position Description
          version String Yes URI parameter API version number
          instanceId String Yes URI parameter Instance ID
          accountName String Yes URI parameter Account name
          databasePrivileges List<DatabasePrivilege> Yes RequestBody parameter Update the account data access list

          Response header field

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

          Response parameter No special response parameter.

          Request example

          PUT https://drds.bj.baidubce.com/v1/instance/drds265l1gltivi/account/user1?updatePrivilege
          Host: drds.bj.baidubce.com
          Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
          {
              "databasePrivileges": [
                  {
                      "dbName": "dbtest",
                      "authType": "ReadOnly"
                  }
              ]
          }

          Response example

          HTTP/1.1 200 OK
          x-bce-request-id: 7869616F-7A68-6977-656E-406261696475
          Content-Type: application/json
          Previous
          Instructions for Database Management Interfaces
          Next
          Instructions for Whitelist Management Interfaces