Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ucloud/core/client/_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class ConfigSchema(schema.Schema):
fields = {
"region": fields.Str(required=True),
"region": fields.Str(),
"project_id": fields.Str(),
"base_url": fields.Str(default="https://api.ucloud.cn"),
"user_agent": fields.Str(),
Expand Down Expand Up @@ -47,7 +47,7 @@ class Config(object):

def __init__(
self,
region,
region=None,
project_id=None,
base_url="https://api.ucloud.cn",
user_agent=None,
Expand Down
4 changes: 3 additions & 1 deletion ucloud/core/client/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,6 @@ def _build_user_agent(self):
return user_agent

def __repr__(self):
return '<{}("{}")>'.format(self.__class__.__name__, self.config.region)
return '<{}(region="{}")>'.format(
self.__class__.__name__, self.config.region
)
2 changes: 1 addition & 1 deletion ucloud/core/utils/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
else:
import types

str = unicode # noqa: F821
str = unicode
string_types = types.StringTypes
from collections import Callable
16 changes: 8 additions & 8 deletions ucloud/services/uphost/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ def describe_phost(self, req=None, **kwargs):

**Response Model**

**PHostCPUSet**

- **CoreCount** (int) - CPU核数
- **Count** (int) - CPU个数
- **Frequence** (float) - CPU主频
- **Model** (str) - CPU型号

**PHostDiskSet**

- **Count** (int) - 磁盘数量
Expand All @@ -73,13 +80,6 @@ def describe_phost(self, req=None, **kwargs):
- **Space** (int) - 单盘大小,单位GB
- **Type** (str) - 磁盘属性

**PHostCPUSet**

- **CoreCount** (int) - CPU核数
- **Count** (int) - CPU个数
- **Frequence** (float) - CPU主频
- **Model** (str) - CPU型号

**PHostIPSet**

- **Bandwidth** (int) - IP对应带宽,单位Mb,内网IP不显示带宽信息
Expand All @@ -93,7 +93,7 @@ def describe_phost(self, req=None, **kwargs):
**PHostSet**

- **AutoRenew** (str) - 自动续费
- **CPUSet** (list) - 见 **PHostCPUSet** 模型定义
- **CPUSet** (dict) - 见 **PHostCPUSet** 模型定义
- **ChargeType** (str) - 计费模式,枚举值为: Year,按年付费; Month,按月付费; Dynamic,按需付费(需开启权限); Trial,试用(需开启权限)默认为月付
- **Cluster** (str) - 网络环境。枚举值:千兆:1G ,万兆:10G
- **Components** (str) - 组件信息(暂不支持)
Expand Down
32 changes: 16 additions & 16 deletions ucloud/services/uphost/schemas/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@
from ucloud.core.typesystem import schema, fields


class PHostCPUSetSchema(schema.ResponseSchema):
""" PHostCPUSet - DescribePHost
class PHostIPSetSchema(schema.ResponseSchema):
""" PHostIPSet - DescribePHost
"""

fields = {
"CoreCount": fields.Int(required=False, load_from="CoreCount"),
"Count": fields.Int(required=False, load_from="Count"),
"Frequence": fields.Float(required=False, load_from="Frequence"),
"Model": fields.Str(required=False, load_from="Model"),
"Bandwidth": fields.Int(required=False, load_from="Bandwidth"),
"IPAddr": fields.Str(required=False, load_from="IPAddr"),
"IPId": fields.Str(required=False, load_from="IPId"),
"MACAddr": fields.Str(required=False, load_from="MACAddr"),
"OperatorName": fields.Str(required=False, load_from="OperatorName"),
"SubnetId": fields.Str(required=False, load_from="SubnetId"),
"VPCId": fields.Str(required=False, load_from="VPCId"),
}


Expand All @@ -29,18 +32,15 @@ class PHostDiskSetSchema(schema.ResponseSchema):
}


class PHostIPSetSchema(schema.ResponseSchema):
""" PHostIPSet - DescribePHost
class PHostCPUSetSchema(schema.ResponseSchema):
""" PHostCPUSet - DescribePHost
"""

fields = {
"Bandwidth": fields.Int(required=False, load_from="Bandwidth"),
"IPAddr": fields.Str(required=False, load_from="IPAddr"),
"IPId": fields.Str(required=False, load_from="IPId"),
"MACAddr": fields.Str(required=False, load_from="MACAddr"),
"OperatorName": fields.Str(required=False, load_from="OperatorName"),
"SubnetId": fields.Str(required=False, load_from="SubnetId"),
"VPCId": fields.Str(required=False, load_from="VPCId"),
"CoreCount": fields.Int(required=False, load_from="CoreCount"),
"Count": fields.Int(required=False, load_from="Count"),
"Frequence": fields.Float(required=False, load_from="Frequence"),
"Model": fields.Str(required=False, load_from="Model"),
}


Expand All @@ -50,7 +50,7 @@ class PHostSetSchema(schema.ResponseSchema):

fields = {
"AutoRenew": fields.Str(required=False, load_from="AutoRenew"),
"CPUSet": fields.List(PHostCPUSetSchema()),
"CPUSet": PHostCPUSetSchema(),
"ChargeType": fields.Str(required=False, load_from="ChargeType"),
"Cluster": fields.Str(required=False, load_from="Cluster"),
"Components": fields.Str(required=False, load_from="Components"),
Expand Down
2 changes: 1 addition & 1 deletion ucloud/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-

version = "0.5.0"
version = "0.5.1"