Interface Instructions
Create Instance
Description
- This interface is used to create one or more “redis” instances.
- To create an instance, you need to perform identity verification. The user who does not pass the identity verification can perform the identity verification under security authentication in the console of the Baidu Open Cloud official website.
- For a postpaid (billing method) instance, the account cash balance + general-type voucher is greater than 100; for a prepaid instance, the account cash balance is greater than or equal to the instance fee.
- The batch creation is supported;if one instance fails to be created during the creation process, all instances will be rolled back.
- The creation interface is created asynchronously. You can query the instance status by querying the specified instance interface details.
Request Structure
POST /v{version}/instance?clientToken={clientToken} HTTP/1.1
HOST: redis.{region}.baidubce.com
Authorization: Authorization string
{
"billing":{
"paymentTiming": paymentTiming,
"reservation": {
"reservationLength": reservationLength
}
},
"purchaseCount" : purchaseCount,
"instanceName" : instanceName,
"instanceClass" : instanceClass
"port" : port,
"engineVersion" : engineVersion,
"vpcId" : vpcId ,
"subnets" :[
{
"zoneName": zoneName,
"subnetId": subnetId
}
]
}
Request Header Field
There are no other special header fields except the public header field.
Request Parameter
Parameter Name | Type | Required | Parameter Position | Description |
---|---|---|---|---|
version | string | Yes | URI Parameter | API version No. |
clientToken | string | Yes | Query parameters | It is an idempotent Token, which is an ASCII character string with length of no more than 64 bits. |
Billing | Billing | Yes | RequestBody parameter | Parameters for billing. Structure and value references |
instanceName | string | Yes | RequestBody parameter | User-defined instance name requirements: 1) Support uppercase and lowercase letters, numbers, and special characters such as -_ /. And must start with a letter; 2) The length should be up to 1-64 bits; |
instanceClass | string | Yes | RequestBody parameter | Instance Specifications |
port | int | Yes | RequestBody parameter | Port number 1025 < port <22222 ,22222 < port < 65535 |
engineVersion | String | Yes | RequestBody parameter | Engine version, Cluster: 2.6, 3.2 Master-slave: 3.2, 4.0 |
purchaseCount | int | No | RequestBody parameter | Number of purchases, up to 10, default 1 |
vpcId | string | No | RequestBody parameter | For vpc, if not provided, it is the default vpc. You can query the available VPC by calling the Query VPC List interface. |
subnets | List<SubnetMap> | No | RequestBody parameter | It specifies the “subnetId” of each availability zone in the “vpc”; if the “vpc” is not the default one, you must specify the “subnetId”. You can query the subnet list by calling the Query Subnet Interface. Configure up to two subnets for each instance. |
SubnetMap
Parameter Name | Type | Description |
---|---|---|
zoneName | String | It specifies the zone information, which is null by default and is automatically selected by the system. You can query the availability zone list by calling the Availability Zone List interface. The ZoneName naming convention is "country-region-availability zone sequence” represented by lowercase letters, for example, Beijing availability zone A is represented with "cn-bj-a". The dedicated instance uses the zone where the dedicated server is located, without specifying this field. |
subnetId | String | It is the subnet Id, if it is null, the default subnet is used. |
Return Header Field
There are no other special header fields except the common header field.
Return Parameters
Parameter Name | Type | Description |
---|---|---|
instanceIds | List InstanceId | Arrays comprised by InstanceIds |
Error Code
Error Code | Error description | HTTP status code | Explanations |
---|---|---|---|
InstanceNameAlreadyExist | You already has a instance with the given name | 400 | The instance name already exists |
ExceedQuota | The scs instances you want to create exceeded the system limit | 400 | The number of SCS instances created exceeds the system limit. |
NotEnoughBalanceForPayOrder | Balance is not enough, please recharge! | 403 | The balance is not enough; please recharge. |
ParamValidationFailed | Parameter validate error:{detail} | 400 | The parameter check is failed. |
ServiceUnavailable | Service is unavailable | 503 | Internal server error occurs. |
Request example
POST /v1/instance?clientToken=be31b98c-5e41-4838-9830-9be700de5a20 HTTP/1.1
HOST: redis.bj.baidubce.com
ContentType: application/json
Authorization bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2017-11-21T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
{
"billing":{
"paymentTiming":"Prepaid",
"reservation": {
"reservationLength": 1
}
},
"purchaseCount" : 1,
"instanceName" : "scs_name",
"instanceClass" : "redis.master.basic",
"port" : 6379,
"engineVersion" : "3.2",
"vpcId" : "vpc-1n1wqxfu4iuu" ,
"subnets":[
{
"zoneName": "cn-bj-a",
"subnetId": "sbn-rvv87cdd0gv9"
}
]
}
Return example
{
"instanceIds":["scs-bj-cxisuftlkquj"]
}
Delete Instance
Description
When a single SCS instance is released, the physical resources used by the instance will be recovered, and all related data will be lost and not be recovered.
Only the expired instances adopting Postpaid or Prepaid mode can be released.
Request Structure
DELETE /v{version}/instance/{instanceId}?HTTP/1.1
HOST: redis.{region}.baidubce.com
Authorization: Authorization string
Request Header Field
There are no other special header fields except the public header field.
Request Parameter
Parameter Name | Type | Required | Parameter Position | Description |
---|---|---|---|---|
version | String | Yes | URI Parameter | API Version No. |
instanceId | String | Yes | Query parameters | Instance Id |
Return Header Field
There are no other special header fields except the common header field.
Return Parameters
No special return parameters.
Error Code
Error Code | Error description | HTTP status code | Explanations |
---|---|---|---|
BadRequest | Bad request parameters or illegal request. | 400 | Error request |
OperationDenied | Prepay type cannot be deleted. | 409 | The pre-paid and unexpired instances cannot be released |
InstanceNotExistException | Instance not found. | 404 | The instance is not found or is not yours. |
InstanceDeleteFailed | Instance {instanceId} delete failed. | 403 | “scs” instance is failed to delete |
ServiceUnavailable | Service is unavailable. | 503 | Internal server error occurs. |
Get Instance Details
Description
Query the details of a single instance
Request Structure
GET /v{version}/instance/{instanceId} HTTP/1.1
Host: redis.{region}.baidubce.com
Authorization: Authorization string
Request Header Field
There are no other special header fields except the public header field.
Request Parameter
Parameter Name | Type | Required | Parameter Position | Description |
---|---|---|---|---|
version | string | Yes | URI Parameter | API Version No. |
instanceId | string | Yes | URI Parameter | Instance ID to be queried |
Return Header Field
There are no other special header fields except the common header field.
Return Parameters
Parameter Name | Type | Description |
---|---|---|
InstanceId | String | Instance ID |
instanceName | String | Instance Name |
instanceStatus | String | Instance status |
architectureType | String | The engine type is Redis. Value: Cluster. “Cluster”: “master_slave”,default: Master_Slave |
engine | String | Engine type, redis, memcache |
engineVersion | String | Engine version |
vnetIp | String | Private IP |
domain | String | Domain name |
port | String | Link port |
instanceCreateTime | Datetime | Instance creation time |
instanceExpireTime | Datetime | Expiry time of instances |
capacity | int | Total capacity (unit: GB) |
usedCapacity | double | Used capacity (unit: GB) |
paymentTiming | String | Mode of Payment Prepaid; postpaid |
zoneNames | List<String> | Availability zone list |
vpcId | String | VPC ID |
subnets | Subnet | Subnet cidr |
Subnet
Parameter Name | Parameter Types | Parameter Descriptions |
---|---|---|
name | String | Subnet name |
subnetId | String | Subnet Id |
zoneName | String | Availability zone of subnet |
cidr | String | Subnet cidr |
vpcId | String | Vpc id |
Request example
GET /v1/instance/scs-bj-cxisuftlkquj HTTP/1.1
HOST: redis.bj.baidubce.com
ContentType: application/json
Authorization bce-auth-v1/0255cb4f78f140728045b551d6a317ec/2018-11-13T05:46:05Z/1800/host/70268ec1d0491c86e67f345ad3aee4cf7f8924dade9b7f3e2f1a95814a00c129
Return example
HTTP/1.1 200 OK
x-bce-request-id: 7869616F-7A68-6977-656E-406261696475
Content-Type: application/json
{
"instanceId": "scs-bj-cxisuftlkquj",
"instanceName": "post101",
"instanceStatus": "Running",
"architectureType": "master_slave",
"engine": "redis",
"engineVersion": "3.2",
"vnetIp": "10.107.231.11",
"domain": "redis.ruqpwjmvrsyt.scs.bj.bce.qa.sandbox.baidu.com",
"port": "6379",
"instanceCreateTime": "2018-11-13T05:37:49Z",
"capacity": 1,
"usedCapacity": 0.06,
"paymentTiming": "Postpaid",
"vpcId": "vpc-1n1wqxfu4iuu",
"subnets": [
{
"name": “System Predefined Subnet C",
"subnetId": "sbn-0ynnfkyymh8z",
"zoneName": "cn-bj-c",
"cidr": "192.168.32.0/20"
},
{
"name": "System Predefined Subnet",
"subnetId": "sbn-rvv87cdd0gv9",
"zoneName": "cn-bj-a",
"cidr": "192.168.0.0/20"
}
],
"zoneNames": [
"cn-bj-a",
"cn-bj-c"
]
}
Get Instance List
Description
You can only view the instance list of your account.
Request Structure
GET /v{version}/instance?marker={marker}&maxKeys={maxKeys} HTTP/1.1
Host: redis.{region}.baidubce.com
Authorization: Authorization string
Request Header Field
There are no other special header fields except the public header field.
Request Parameter
Parameter Name | Type | Required | Parameter Position | Description |
---|---|---|---|---|
version | string | Yes | URI Parameter | API Version No. |
marker | string | No | Query parameters /td> | The start position of query for the list obtained in batch is a character string generated by the system. |
maxKeys | int | No | Query parameters | The maximum number of maxKeys contained in each page (master instance) is usually not more than 1000 and the default value is 1000. |
Return Header Field
There are no other special header fields except the common header field.
Return Parameters
Parameter Name | Type | Description |
---|---|---|
marker | String | The start position of query for the list obtained in batch is a character string generated by the system. |
maxKeys | int | It is the maximum number of maxKeys contained in each page, which is usually does not exceed 1000 and the default value is 1000. |
isTruncated | boolean | True means there is still data behind, and false means it is already the last page. |
nextMarker | String | Get the marker value to be passed on the next page. This field does not appear when “isTruncated” is false. |
Instances | List<InstanceModel> | Arrays comprised by InstanceModel |
Request example
GET /v1/instance?marker=-1&maxKeys=20 HTTP/1.1
HOST: redis.bj.baidubce.com
ContentType: application/json
Authorization bce-auth-v1/0255cb4f78f140728045b551d6a317ec/2018-11-13T05:57:04Z/1800/host/633fd6aadc177fce91e5e930c63886b5fb4da8938d9a02c9d13df4fdb8efdec5
Return example
{
"marker": "-1",
"isTruncated": true,
"nextMarker": "1058",
"maxKeys": 1,
"instances": [
{
"instanceId": "scs-bj-cxisuftlkquj",
"instanceName": "post101",
"instanceStatus": "Running",
"engine": "redis",
"engineVersion": "3.2",
"vnetIp": "10.107.231.11",
"domain": "redis.ruqpwjmvrsyt.scs.bj.bce.qa.sandbox.baidu.com",
"port": "6379",
"instanceCreateTime": "2018-11-13T05:37:49Z",
"capacity": 1,
"usedCapacity": 0.06,
"paymentTiming": "Postpaid",
"zoneNames": [
"cn-bj-a",
"cn-bj-c"
]
}
]
}
Get the Availability Zone List
Request Structure
GET /v{version}/zone HTTP/1.1
HOST: redis.{region}.baidubce.com
Authorization: Authorization string
Request Header Field
There are no other special header fields except the public header field.
Request Parameter
Parameter Name | Type | Required | Parameter Position | Description |
---|---|---|---|---|
version | string | Yes | URI Parameter | API Version No. |
Return Parameters
Parameter Name | Type | Description |
---|---|---|
zones | List ZoneNames | Availability zone list |
ZoneNames
Parameter Name | Type | Description |
---|---|---|
zoneNames | List String | Availability zone list |
Request example
GET /v1/zone HTTP/1.1
HOST: redis.bj.baidubce.com
Authorization bce-auth-v1/0255cb4f78f140728045b551d6a317ec/2018-11-13T06:05:41Z/1800/host/7767a07238b64a846fef59a0b919eec99d147e5fe23be98ff6bf90e32e889baf
Return example
HTTP/1.1 200 OK
x-bce-request-id: 7869616F-7A68-6977-656E-406261696475
Content-Type: application/json
Content-Length: 567
{
"zones": [
{"zoneNames":["cn-bj-a"]},
{"zoneNames":["cn-bj-b"]},
{"zoneNames":["cn-bj-a","cn-bj-b"]}
]
}
Get the Dubnet List
Request Structure
GET /v{version}/subnet?vpcId={vpcId}&zoneName={zoneName} HTTP/1.1
HOST: redis.{region}.baidubce.com
Authorization: Authorization string
Request Header Field
There are no other special header fields except the public header field.
Request Parameter
Parameter Name | Type | Required | Parameter Position | Description |
---|---|---|---|---|
version | String | Yes | URI Parameter | API Version No. |
vpcId | String | No | Query parameters | Vpc Id |
zoneName | String | No | Query parameters | Name of availability zone |
Return Header Field
There are no other special header fields except the common header field.
Return Parameters
Parameter Name | Type | Description |
---|---|---|
subnets | List Subnet | Subnet list |
Subnet Object details
Parameter Name | Parameter Types | Parameter Descriptions |
---|---|---|
name | String | Subnet name |
subnetId | String | Subnet Id |
zoneName | String | Availability zone of subnet |
cidr | String | Subnet cidr |
vpcId | String | Vpc id |
Request example
GET /v1/subnet?vpcId=vpc-1n1wqxfu4iuu&zoneName=cn-bj-a HTTP/1.1
HOST: redis.bj.baidubce.com
Authorization bce-auth-v1/0255cb4f78f140728045b551d6a317ec/2018-11-13T06:13:25Z/1800/host/2feac87a586a66c048be0b6ef2d02fdfca7d65cf9b6c9e6b9efe20bac95b7c7a
Return example
HTTP/1.1 200 OK
x-bce-request-id: 7869616F-7A68-6977-656E-406261696475
Content-Type: application/json
Content-Length: 150
{
"subnets": [
{
"name": "System Predefined Subnet B",
"subnetId": "sbn-4zt8126ea6c3",
"cidr": "192.168.16.0/20",
"zoneName": "cn-bj-b",
"vpcId": "vpc-1n1wqxfu4iuu"
}
]
}