创建云数据库MySQL实例
# 1.接口描述
Action:CreateDBInstance
描述: 创建MySQL云数据库实例
请求地址: cdsapi.capitalonline.net/mysql
请求方法: POST
# 2.请求参数
参数名 | 必选 | 类型 | 说明 |
---|---|---|---|
RegionId | 是 | string | 站点编号 |
VdcId | 是 | string | 数据中心的编号 |
BasePipeId | 是 | string | 数据中心的私网编号,创建服务将按这个私网分配IP |
InstanceName | 是 | string | 实例名称 |
PaasGoodsId | 是 | int | 产品的规格编号 |
DiskType | 是 | string | 磁盘类型 只能选择支持的磁盘类型 |
DiskValue | 是 | int | 磁盘大小 |
TimeZone | 否 | string | 实例的UTC时区,默认值根据地域不同变化,输入参数范围: ["-12:00","-11:00","-10:00","-09:00","-08:00","-07:00","-06:00","-05:00","-04:00","-03:00","-02:00","-01:00","+00:00","+01:00","+02:00","+03:00","+04:00","+05:00","+05:30","+06:00","+07:00","+08:00","+09:00","+10:00","+11:00","+12:00","+13:00"] |
Amount | 否 | int | 购买的数量,一次最多购买10个 |
ServicePort | 否 | int | MySQL实例端口,默认3306,取值范围:1024-65535(9100和9101无效) |
# 3.请求示例
def create_mysql():
"""
创建MySQL实例
"""
action = "CreateDBInstance"
method = "POST"
param = {}
url = get_signature(action, AK, AccessKeySecret, method, MYSQL_URL, param=param)
body = {
"RegionId": "******",
"VdcId": "******",
"BasePipeId": "******",
"InstanceName": "******",
"PaasGoodsId": ******,
"DiskType": "******",
"DiskValue": 100,
"ServicePort": 6033,
"Password": "******",
"Amount": 1
}
res = requests.post(url, json=body)
result = json.loads(res.content)
print(result)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 4.返回参数
参数名 | 类型 | 说明 |
---|---|---|
Message | string | 信息描述 |
Code | string | 状态码 |
Data | dict | 包含任务编码和实例编码列表 |
InstancesUuid | list | 实例编码 |
TaskId | string | 任务id |
# 5.返回示例
{
"Message": "Success.",
"Code": "Success",
"Data": {
"InstancesUuid":["5d74bb81-0473-464d-b15b-0ae418619248"]
},
"TaskId": "**********"
}
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8