获取用户配额
接口
get_quotas
参数
无。
返回值
get_quotas方法将返回一个 GetResponse
对象,封装了 Quotas 对象的所有接口和属性。
Quotas 属性
属性 | 类型 | 说明 |
AvailableClusterResourceType | list | 可用的资源类型 |
AvailableClusterInstanceType | list | 可用的实例类型 |
AvailableSpotInstanceType | list | 可用的竞价实例类型 |
AvailableClusterInstanceSystemDiskType | list | 可用的系统盘类型 |
AvailableClusterInstanceDataDiskType | list | 可用的数据盘类型 |
例子
Python源码:
import time
import batchcompute
from batchcompute import CN_SHENZHEN as REGION
from batchcompute import Client, ClientError
ACCESS_KEY_ID = 'Your Access Key Id'
ACCESS_KEY_SECRET = 'Your Access Key Secret'
client = Client(REGION, ACCESS_KEY_ID, ACCESS_KEY_SECRET)
def get_quotas():
try:
rsp = client.get_quotas()
print rsp
except ClientError, e:
print (e.get_status_code(), e.get_code(), e.get_requestid(), e.get_msg())
if __name__ == '__main__':
get_quotas()
执行结果:
{
"AvailableSpotInstanceType": [
"ecs.c1.large",
"ecs.c4.2xlarge",
"ecs.sn2ne.large"
],
"AvailableClusterInstanceDataDiskType": [
"cloud",
"cloud_efficiency",
"cloud_ssd",
"ephemeral",
"ephemeral_ssd"
],
"AvailableClusterInstanceType": [
"bcs.a2.3xlarge",
"ecs.sn2ne.xlarge"
],
"AvailableClusterInstanceSystemDiskType": [
"cloud",
"cloud_efficiency",
"cloud_ssd",
"ephemeral",
"ephemeral_ssd"
],
"AvailableClusterResourceType": [
"OnDemand",
"PrePaid",
"Spot"
]
}