Skip to content

Commit 8d4fd7c

Browse files
authored
auto codegen for VPC2.0
1 parent 00aaa35 commit 8d4fd7c

File tree

3 files changed

+366
-20
lines changed

3 files changed

+366
-20
lines changed

ucloud/services/vpc/client.py

Lines changed: 186 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,38 @@ def __init__(
1313
):
1414
super(VPCClient, self).__init__(config, transport, middleware, logger)
1515

16+
def add_snat_rule(
17+
self, req: typing.Optional[dict] = None, **kwargs
18+
) -> dict:
19+
"""AddSnatRule - 对于绑定了多个EIP的NAT网关,您可以将一个子网下的某台云主机映射到某个特定的EIP上,规则生效后,则该云主机通过该特定的EIP访问互联网。
20+
21+
**Request**
22+
23+
- **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list>`_
24+
- **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_
25+
- **NATGWId** (str) - (Required) NAT网关的ID
26+
- **SnatIp** (str) - (Required) EIP的ip地址,例如106.75.xx.xx
27+
- **SourceIp** (str) - (Required) 需要出外网的私网IP地址,例如10.9.7.xx
28+
- **Name** (str) - snat规则名称,默认为“出口规则”
29+
30+
**Response**
31+
32+
33+
"""
34+
# build request
35+
d = {
36+
"ProjectId": self.config.project_id,
37+
"Region": self.config.region,
38+
}
39+
req and d.update(req)
40+
d = apis.AddSnatRuleRequestSchema().dumps(d)
41+
42+
# build options
43+
kwargs["max_retries"] = 0 # ignore retry when api is not idempotent
44+
45+
resp = self.invoke("AddSnatRule", d, **kwargs)
46+
return apis.AddSnatRuleResponseSchema().loads(resp)
47+
1648
def add_vpc_network(
1749
self, req: typing.Optional[dict] = None, **kwargs
1850
) -> dict:
@@ -721,6 +753,33 @@ def delete_secondary_ip(
721753
resp = self.invoke("DeleteSecondaryIp", d, **kwargs)
722754
return apis.DeleteSecondaryIpResponseSchema().loads(resp)
723755

756+
def delete_snat_rule(
757+
self, req: typing.Optional[dict] = None, **kwargs
758+
) -> dict:
759+
"""DeleteSnatRule - 删除指定的出口规则(SNAT规则)
760+
761+
**Request**
762+
763+
- **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list>`_
764+
- **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_
765+
- **NATGWId** (str) - (Required) NAT网关的ID
766+
- **SourceIp** (str) - (Required) 需要出外网的私网IP地址,例如10.9.7.xx
767+
768+
**Response**
769+
770+
771+
"""
772+
# build request
773+
d = {
774+
"ProjectId": self.config.project_id,
775+
"Region": self.config.region,
776+
}
777+
req and d.update(req)
778+
d = apis.DeleteSnatRuleRequestSchema().dumps(d)
779+
780+
resp = self.invoke("DeleteSnatRule", d, **kwargs)
781+
return apis.DeleteSnatRuleResponseSchema().loads(resp)
782+
724783
def delete_subnet(
725784
self, req: typing.Optional[dict] = None, **kwargs
726785
) -> dict:
@@ -852,12 +911,6 @@ def describe_natgw(
852911
- **OperatorName** (str) - IP的运营商信息
853912
854913
855-
**NatGatewaySubnetSet**
856-
- **Subnet** (str) - 子网网段
857-
- **SubnetName** (str) - 子网名字
858-
- **SubnetworkId** (str) - 子网id
859-
860-
861914
**NatGatewayIPSet**
862915
- **Bandwidth** (int) - 带宽
863916
- **BandwidthType** (str) - EIP带宽类型
@@ -866,6 +919,12 @@ def describe_natgw(
866919
- **Weight** (int) - 权重为100的为出口
867920
868921
922+
**NatGatewaySubnetSet**
923+
- **Subnet** (str) - 子网网段
924+
- **SubnetName** (str) - 子网名字
925+
- **SubnetworkId** (str) - 子网id
926+
927+
869928
**NatGatewayDataSet**
870929
- **CreateTime** (int) - natgw创建时间
871930
- **FirewallId** (str) - 绑定的防火墙Id
@@ -1246,6 +1305,47 @@ def describe_secondary_ip(
12461305
resp = self.invoke("DescribeSecondaryIp", d, **kwargs)
12471306
return apis.DescribeSecondaryIpResponseSchema().loads(resp)
12481307

1308+
def describe_snat_rule(
1309+
self, req: typing.Optional[dict] = None, **kwargs
1310+
) -> dict:
1311+
"""DescribeSnatRule - 获取Nat网关的出口规则(SNAT规则)
1312+
1313+
**Request**
1314+
1315+
- **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list>`_
1316+
- **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_
1317+
- **NATGWId** (str) - (Required) NAT网关的ID
1318+
- **Limit** (str) - 分页,默认为20
1319+
- **Offset** (str) - 偏移,默认为0
1320+
- **SnatIp** (str) - EIP的ip地址,例如106.75.xx.xx
1321+
- **SourceIp** (str) - 需要出外网的私网IP地址,例如10.9.7.xx
1322+
1323+
**Response**
1324+
1325+
- **DataSet** (list) - 见 **NATGWSnatRule** 模型定义
1326+
- **TotalCount** (int) - 规则数量
1327+
1328+
**Response Model**
1329+
1330+
**NATGWSnatRule**
1331+
- **Name** (str) - snat规则名称
1332+
- **SnatIp** (str) - EIP地址,如106.76.xx.xx
1333+
- **SourceIp** (str) - 资源的内网IP地址
1334+
- **SubnetworkId** (str) - SourceIp所属的子网id
1335+
1336+
1337+
"""
1338+
# build request
1339+
d = {
1340+
"ProjectId": self.config.project_id,
1341+
"Region": self.config.region,
1342+
}
1343+
req and d.update(req)
1344+
d = apis.DescribeSnatRuleRequestSchema().dumps(d)
1345+
1346+
resp = self.invoke("DescribeSnatRule", d, **kwargs)
1347+
return apis.DescribeSnatRuleResponseSchema().loads(resp)
1348+
12491349
def describe_subnet(
12501350
self, req: typing.Optional[dict] = None, **kwargs
12511351
) -> dict:
@@ -1487,8 +1587,10 @@ def describe_white_list_resource(
14871587
**Request**
14881588
14891589
- **ProjectId** (str) - (Config) 项目id
1490-
- **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist.html>`_
1590+
- **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_
14911591
- **NATGWIds** (list) - (Required) NAT网关的Id
1592+
- **Limit** (int) - 数据分页值, 默认为20
1593+
- **Offset** (int) - 数据偏移量, 默认为0
14921594
14931595
**Response**
14941596
@@ -1561,10 +1663,10 @@ def get_available_resource_for_policy(
15611663
15621664
**Request**
15631665
1564-
- **ProjectId** (str) - (Config) 项目Id。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list.html>`_
1565-
- **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist.html>`_
1666+
- **ProjectId** (str) - (Config) 项目Id。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list>`_
1667+
- **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_
15661668
- **NATGWId** (str) - (Required) NAT网关Id
1567-
- **Limit** (int) - 返回数据长度,默认为10000
1669+
- **Limit** (int) - 返回数据长度,默认为20
15681670
- **Offset** (int) - 列表起始位置偏移量,默认为0
15691671
15701672
**Response**
@@ -1591,6 +1693,49 @@ def get_available_resource_for_policy(
15911693
resp = self.invoke("GetAvailableResourceForPolicy", d, **kwargs)
15921694
return apis.GetAvailableResourceForPolicyResponseSchema().loads(resp)
15931695

1696+
def get_available_resource_for_snat_rule(
1697+
self, req: typing.Optional[dict] = None, **kwargs
1698+
) -> dict:
1699+
"""GetAvailableResourceForSnatRule - 获取可用于添加snat规则(出口规则)的资源列表
1700+
1701+
**Request**
1702+
1703+
- **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list>`_
1704+
- **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_
1705+
- **NATGWId** (str) - (Required) NAT网关Id
1706+
- **Limit** (int) - 数据分页值, 默认为20
1707+
- **Offset** (int) - 数据偏移量, 默认为0
1708+
1709+
**Response**
1710+
1711+
- **Action** (str) - 操作名称
1712+
- **DataSet** (list) - 见 **GetAvailableResourceForSnatRuleDataSet** 模型定义
1713+
- **RetCode** (str) - 返回值
1714+
- **TotalCount** (int) - 总数
1715+
1716+
**Response Model**
1717+
1718+
**GetAvailableResourceForSnatRuleDataSet**
1719+
- **PrivateIP** (str) - 资源内网IP
1720+
- **ResourceId** (str) - 资源ID
1721+
- **ResourceName** (str) - 资源名称
1722+
- **ResourceType** (str) - 资源类型
1723+
- **SubnetworkId** (str) - 资源所属VPC的ID
1724+
- **VPCId** (str) - 资源所属子网的ID
1725+
1726+
1727+
"""
1728+
# build request
1729+
d = {
1730+
"ProjectId": self.config.project_id,
1731+
"Region": self.config.region,
1732+
}
1733+
req and d.update(req)
1734+
d = apis.GetAvailableResourceForSnatRuleRequestSchema().dumps(d)
1735+
1736+
resp = self.invoke("GetAvailableResourceForSnatRule", d, **kwargs)
1737+
return apis.GetAvailableResourceForSnatRuleResponseSchema().loads(resp)
1738+
15941739
def get_available_resource_for_white_list(
15951740
self, req: typing.Optional[dict] = None, **kwargs
15961741
) -> dict:
@@ -1601,6 +1746,8 @@ def get_available_resource_for_white_list(
16011746
- **ProjectId** (str) - (Config) 项目Id。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list>`_
16021747
- **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_
16031748
- **NATGWId** (str) - (Required) NAT网关Id
1749+
- **Limit** (int) - 数据分页值, 默认为20
1750+
- **Offset** (int) - 数据偏移量, 默认为0
16041751
16051752
**Response**
16061753
@@ -1944,6 +2091,35 @@ def update_route_table_attribute(
19442091
resp = self.invoke("UpdateRouteTableAttribute", d, **kwargs)
19452092
return apis.UpdateRouteTableAttributeResponseSchema().loads(resp)
19462093

2094+
def update_snat_rule(
2095+
self, req: typing.Optional[dict] = None, **kwargs
2096+
) -> dict:
2097+
"""UpdateSnatRule - 更新指定的出口规则(SNAT规则)
2098+
2099+
**Request**
2100+
2101+
- **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list>`_
2102+
- **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_
2103+
- **NATGWId** (str) - (Required) NAT网关的ID,
2104+
- **SnatIp** (str) - (Required) EIP的ip地址,例如106.75.xx.xx
2105+
- **SourceIp** (str) - (Required) 需要出外网的私网IP地址,例如10.9.7.xx
2106+
- **Name** (str) - snat名称,即出口规则名称
2107+
2108+
**Response**
2109+
2110+
2111+
"""
2112+
# build request
2113+
d = {
2114+
"ProjectId": self.config.project_id,
2115+
"Region": self.config.region,
2116+
}
2117+
req and d.update(req)
2118+
d = apis.UpdateSnatRuleRequestSchema().dumps(d)
2119+
2120+
resp = self.invoke("UpdateSnatRule", d, **kwargs)
2121+
return apis.UpdateSnatRuleResponseSchema().loads(resp)
2122+
19472123
def update_subnet_attribute(
19482124
self, req: typing.Optional[dict] = None, **kwargs
19492125
) -> dict:

0 commit comments

Comments
 (0)