实例操作
更新时间:2024-12-14
创建实例CreateInstance
描述
创建一个实例,要求名称不能和同Region内现有任何一个Instance重名,限制字符个数3-255,满足正则:[a-zA-Z_][a-za-z0-9\_]{2,254}。 实例名称不能包含 [‘baidu’, ‘bidu’, ‘bce’, ‘bts’] 这几个单词,不能以‘__’(两个下划线)开头。
请求
Verb | URI |
---|---|
PUT | /v{version}/instance/{instanceName} |
请求参数
参数名称 | 是否必须 | 参数类型 | 说明 |
---|---|---|---|
storageType | 否 | string | 该Instance下表的默认存储类型。 若创建表时未指定存储类型,则默认使用所属Instance的表存储类型. |
响应参数
无
错误码
http_code | code | 说明 |
---|---|---|
201 | - | 创建成功 |
401 | AuthenticationFailed | 认证失败 |
400 | InvalidURI | URI非法 |
405 | MethodNotAllowed | 传递了不支持的HTTP方法 |
400 | InvalidContentType | 请求头域Content-Type是不支持的类型 |
400 | InvalidAutherization | 请求头域Autherization没有传递 |
400 | EmptyDate | 请求头域Date或x-bce-date都没有传递 |
400 | InvalidContentLength | 请求头域Content-Length没有传递 |
400 | ContentLengthMismatchBodySize | 请求头域的Content-Length和实际Request body大小不等 |
400 | MalformedJSON | 请求体传递的json无法解析 |
500 | InternalError | 服务内部错误,需联系技术人员解决 |
403 | ReachMaxInstanceCount | 达到可建立的instance上限20个 |
409 | InstanceAlreadyExist | Instance已存在 |
400 | InvalidInstanceName | Instance名称不合法 |
请求示例
(1) 未设置 Instance 表格存储类型(默认使用高性能型存储类型)
Plain Text
1PUT /v1/instance/ins1 HTTP/1.1
2HOST: bts.bd.baidubce.com
3Authorization: bce-auth-v1/table-access-key/2018-05-24T13:41:13Z/1800/x-bce-date/{signature}
4Content-Type: application/json
5Content-Length: {payloadSizeBytes}
6x-bce-date: 2018-05-24T13:41:13Z
(2) 设置 Instance 表格存储类型
Plain Text
1PUT /v1/instance/ins1 HTTP/1.1
2HOST: bts.bd.baidubce.com
3Authorization: bce-auth-v1/table-access-key/2018-05-24T13:41:13Z/1800/x-bce-date/{signature}
4Content-Type: application/json
5Content-Length: {payloadSizeBytes}
6x-bce-date: 2018-05-24T13:41:13Z
7
8{
9 "storageType": "HighPerformance"
10}
响应示例
Plain Text
1HTTP/1.1 201 Created
2Date: Sat, 18 Aug 2018 18:18:18 GMT
3Content-Type: application/json; charset=utf-8
4Content-Length: {payloadSizeBytes}
5x-bce-request-id: 7869616F-7A68-6977-656E-406261696475
6
7{}
删除实例DropInstance
描述
删除一个实例,要求实例下不存在任何表,否则删除失败。删除实例是一个同步操作过程,一旦返回成功,实例将不复存在。
请求
Verb | URI |
---|---|
DELETE | /v{version}/instance/{instanceName} |
请求参数
无
响应参数
无
错误码
http_code | code | 说明 |
---|---|---|
20x | - | 返回20x类均表示删除成功 |
401 | AuthenticationFailed | 认证失败 |
400 | InvalidURI | URI非法 |
405 | MethodNotAllowed | 传递了不支持的HTTP方法 |
400 | InvalidContentType | 请求头域Content-Type是不支持的类型 |
400 | InvalidAutherization | 请求头域Autherization没有传递 |
400 | EmptyDate | 请求头域Date或x-bce-date都没有传递 |
400 | InvalidContentLength | 请求头域Content-Length没有传递 |
400 | ContentLengthMismatchBodySize | 请求头域的Content-Length和实际Request body大小不等 |
400 | MalformedJSON | 请求体传递的json无法解析 |
500 | InternalError | 服务内部错误,需联系技术人员解决 |
404 | InstanceNotExist | Instance不存在 |
403 | AccessDenied | 请求被拒绝,Instance下有未清除的表存在 |
400 | InvalidInstanceName | Instance名称不合法 |
403 | InstanceCreating | 实例创建中,请稍候 |
请求示例
Plain Text
1DELETE /v1/instance/ins1 HTTP/1.1
2HOST: bts.bd.baidubce.com
3Authorization: bce-auth-v1/table-access-key/2018-05-24T13:41:13Z/1800/x-bce-date/{signature}
4Content-Type: application/json
5Content-Length: {payloadSizeBytes}
6x-bce-date: 2018-05-24T13:41:13Z
响应示例
Plain Text
1HTTP/1.1 200 OK
2Date: Sat, 18 Aug 2018 18:18:18 GMT
3Content-Type: application/json; charset=utf-8
4Content-Length: {payloadSizeBytes}
5x-bce-request-id: 7869616F-7A68-6977-656E-406261696475
6
7{}
列举实例ListInstances
描述
列出账户一个Region内创建的所有实例。
请求
Verb | URI |
---|---|
GET | /v{version}/instances |
请求参数
无
响应参数
参数名称 | 参数类型 | 说明 |
---|---|---|
instances | list | instance列表 |
+id | string | instance ID |
+name | string | instanceName |
+region | string | 所属百度智能云region |
+state | string | instance当前状态,目前只有Normal状态: - Normal:instance处于正常状态 |
+createTime | string | instance创建的UTC时间 |
+storageType | string | 该Instance下表的默认存储类型 |
错误码
http_code | code | 说明 |
---|---|---|
200 | - | 请求成功 |
401 | AuthenticationFailed | 认证失败 |
400 | InvalidURI | URI非法 |
405 | MethodNotAllowed | 传递了不支持的HTTP方法 |
400 | InvalidContentType | 请求头域Content-Type是不支持的类型 |
400 | InvalidAutherization | 请求头域Autherization没有传递 |
400 | EmptyDate | 请求头域Date或x-bce-date都没有传递 |
400 | InvalidContentLength | 请求头域Content-Length没有传递 |
400 | ContentLengthMismatchBodySize | 请求头域的Content-Length和实际Request body大小不等 |
400 | MalformedJSON | 请求体传递的json无法解析 |
500 | InternalError | 服务内部错误,需联系技术人员解决 |
400 | InvalidInstanceName | Instance名称不合法 |
请求示例
Plain Text
1GET /v1/instances HTTP/1.1
2HOST: bts.bd.baidubce.com
3Authorization: bce-auth-v1/table-access-key/2018-05-24T13:41:13Z/1800/x-bce-date/{signature}
4Content-Type: application/json
5Content-Length: {payloadSizeBytes}
6x-bce-date: 2018-05-24T13:41:13Z
响应示例
Plain Text
1HTTP/1.1 200 OK
2Date: Sat, 18 Aug 2018 18:18:18 GMT
3Content-Type: application/json; charset=utf-8
4Content-Length: {payloadSizeBytes}
5x-bce-request-id: 7869616F-7A68-6977-656E-406261696475
6
7{
8 "instances": [
9 {
10 "id": "btsi-123456789",
11 "name": "ins1",
12 "region": "bd",
13 "state": "Normal",
14 "createTime": "2018-05-06T14:32:09Z"
15 "storageType": "HighPerformance"
16 },
17 {
18 "id": "btsi-345678932",
19 "name": "ins2",
20 "region": "bd",
21 "state": "Normal",
22 "createTime": "2018-05-06T14:32:09Z"
23 "storageType": "CommonPerformance"
24 }
25 ]
26}
显示实例信息ShowInstance
描述
显示指定实例信息。
请求
Verb | URI |
---|---|
GET | /v{version}/instance/{instanceName} |
请求参数
无
响应参数
参数名称 | 参数类型 | 说明 |
---|---|---|
id | string | instance ID |
name | string | instanceName |
region | string | 所属百度智能云region |
state | string | instance当前状态,目前只有Normal状态。 - Normal:instance处于正常状态 |
createTime | string | instance创建的UTC时间 |
storageType | string | 该Instance下表的默认存储类型 |
错误码
http_code | code | 说明 |
---|---|---|
200 | - | 请求成功 |
401 | AuthenticationFailed | 认证失败 |
400 | InvalidURI | URI非法 |
405 | MethodNotAllowed | 传递了不支持的HTTP方法 |
400 | InvalidContentType | 请求头域Content-Type是不支持的类型 |
400 | InvalidAutherization | 请求头域Autherization没有传递 |
400 | EmptyDate | 请求头域Date或x-bce-date都没有传递 |
400 | InvalidContentLength | 请求头域Content-Length没有传递 |
400 | ContentLengthMismatchBodySize | 请求头域的Content-Length和实际Request body大小不等 |
400 | MalformedJSON | 请求体传递的json无法解析 |
500 | InternalError | 服务内部错误,需联系技术人员解决 |
404 | InstanceNotExist | Instance不存在 |
403 | AccessDenied | 请求了不属于自己创建的Instance |
400 | InvalidInstanceName | Instance名称不合法 |
请求示例
Plain Text
1GET /v1/instance/ins1 HTTP/1.1
2HOST: bts.bd.baidubce.com
3Authorization: bce-auth-v1/table-access-key/2018-05-24T13:41:13Z/1800/x-bce-date/{signature}
4Content-Type: application/json
5Content-Length: {payloadSizeBytes}
6x-bce-date: 2018-05-24T13:41:13Z
响应示例
Plain Text
1HTTP/1.1 200 OK
2Date: Sat, 18 Aug 2018 18:18:18 GMT
3Content-Type: application/json; charset=utf-8
4Content-Length: {payloadSizeBytes}
5x-bce-request-id: 7869616F-7A68-6977-656E-406261696475
6
7{
8 "id": "btsi-123456789",
9 "name": "ins1",
10 "region": "bd",
11 "state": "Normal",
12 "createTime": "2018-05-06T11:22:33Z"
13 "storageType": "HighPerformance"
14}