SNAT

Snat 对象内容:

 {
            "Name": "luodan-online-vpc-SNAT", # 公网snat名字
            "VpcId": "f7f6fb3f-bd5c-4b4d-acb6-e2355af4f1ee", # 子网所属vpcId
            "Spec": "XS", # snat规格,微型:XS,标准型:S,中型:M,大型:L
超大型:XL,

            "PayType":"PrePay",  # snat实例 付费类型,PostPaid 后付费 ,PrePay 预付费 
            "Period": 1,  # 预付费实例的预付费时长,单位:月,限定值:1-9,12,24,后付费PostPaid实例此字段为 1
            "TerminateMethod":"PERSIST",  # 预付费PrePay实例到期策略,支持PERSIST (到期转按量) DELETE(到期删除),后付费PostPaid实例此字段为空"" 
            "Id": "22116cb0-7590-4693-961a-abd0480efa10",   # snatId
            "NetworkChargeType": "FLOW"  # snat流量收费类型FLOW,按流量计费,按量实例支持该类型BANDWIDTH,按带宽计费,包年包月实例支持此类型,目前未开放PeakBandwidthDaily 日峰值带宽 
            "InternetBandwidth": 44  # Snat网关带宽,按量实例与规格最大带宽相同,包年包月实例与用户创建时选择的带宽相同
            "Status": "Active"  # 状态 Active正常,Unavailable,不可用欠费停服,Disabled 禁用   
            "Ips":  "115.238.116.181,115.238.116.180",  #SNAT上的对外公网ip
            "CreateAt": "2017-08-11T03:46:28Z", # 创建时间,UTC时间
            "UpdateAt": "2017-12-12T10:23:30Z" # 更新时间,UTC时间
 }

1. 创建Snat CreateSnatGateway

接口方法:POST

请求示例:

https://open.cn-east-1.163yun.com/vpc?Version=2017-11-30&Action=CreateSnatGateway
-d'{
    "VpcId": "a007fc18-2b71-4aa7-b50f-c1becbdf1e7a",
    "Spec": "S",
    "PayType": "PostPaid",
    "NetworkChargeType": "FLOW"
}'

url 参数:

参数是否必选说明
VersionAPI 版本号
ActionCreateSnatGateway,新建SNAT 网关

body 参数:

参数是否必填说明
VpcId必选网络id
Spec必选snat规格,微型:XS,标准型:S,中型:M,大型:L,超大型:XL
PayType必选付费类型,PostPaid 后付费/PrePay: 预付费
Period可选当PayType为 PrePay的时候必选,Period的可选范围为1-9,12,24
NetworkChargeType必选网络资源计费类型 目前预付费实例仅支持BANDWIDTH,后付费实例仅支持FLOW
InternetBandwidth可选snat网关带宽 目前仅预付费实例支持该带宽值配置,不能超过该规格的最大带宽,按量实例将默认该值为规格的最大带宽
AutoRenewPeriod可选自动续订参数,该值目前不开放,和交互保持一致默认为0.
TerminateMethod可选包年包月到期策略,该值目前不开放,和交互保持一致默认为PERSIST
OrderId可选订单Id,如果不传的话将会代用户下单,传的话将会检验订单有效性

响应示例:

{
    "SnatGateway": {
        "Id": "f114d99e-5f56-426e-bae9-34b0bdcbcef0",
        "VpcId": "a007fc18-2b71-4aa7-b50f-c1becbdf1e7a",
        "Spec": "S",
        "PayType": "PostPaid",
        "Period": 1,
        "NetworkChargeType": "FLOW",
        "InternetBandwidth": 100,
        "Ips": "59.111.149.248,59.111.149.247",
        "Name": "MyVPC-SNAT",
        "Status": "Active",
        "TerminateMethod": "",
        "CreateAt": "2018-11-22T02:43:38Z",
        "UpdateAt": "2018-11-22T02:43:38Z"
    },
    "OrderId": "fc181122104338638169",
    "RequestId": "1aac5a2b-383e-464f-853a-84bcf48da783"
}

2. 删除Snat DeleteSnatGateway

接口方法:GET

请求示例:

https://open.cn-east-1.163yun.com/vpc?Version=2017-11-30&Action=DeleteSnatGateway&Id=f114d99e-5f56-426e-bae9-34b0bdcbcef0

url 参数:

参数是否必选说明
VersionAPI 版本号
ActionDeleteSnatGateway,删除SNAT网关
Id必选要删除的网关的ID

响应示例:

{
    "SnatGateway": {
        "Id": "f114d99e-5f56-426e-bae9-34b0bdcbcef0",
        "VpcId": "a007fc18-2b71-4aa7-b50f-c1becbdf1e7a",
        "Spec": "S",
        "PayType": "PostPaid",
        "Period": 1,
        "NetworkChargeType": "FLOW",
        "InternetBandwidth": 100,
        "Ips": "59.111.149.248,59.111.149.247",
        "Name": "MyVPC-SNAT",
        "Status": "Active",
        "TerminateMethod": "",
        "CreateAt": "2018-11-22T02:43:38Z",
        "UpdateAt": "2018-11-22T02:43:38Z"
    },
    "RequestId": "4020660d-2f86-46ea-bec8-369a5bc577d8"
}

3. 获取单个Snat详情 GetSnatGateway

接口方法:GET

请求示例:

https://open.cn-east-1.163yun.com/vpc?Version=2017-11-30&Action=GetSnatGateway&Id=ab90f243-07dd-423f-a6bb-83e7b3391645

url 参数:

参数是否必选说明
VersionAPI 版本号
ActionGetSnatGateway,获取指定SNAT网关的详细信息
Id必选网关的id

响应示例:

{
    "SnatGateway": {
        "Id": "ab90f243-07dd-423f-a6bb-83e7b3391645",
        "VpcId": "a007fc18-2b71-4aa7-b50f-c1becbdf1e7a",
        "Spec": "S",
        "PayType": "PostPaid",
        "Period": 1,
        "NetworkChargeType": "FLOW",
        "InternetBandwidth": 100,
        "Ips": "59.111.149.254,59.111.149.26",
        "Name": "MyVPC-SNAT",
        "Status": "Active",
        "TerminateMethod": "",
        "CreateAt": "2018-11-22T03:28:15Z",
        "UpdateAt": "2018-11-22T03:28:15Z"
    },
    "RequestId": "7c9fe963-24e1-4de4-bdd9-a90bb003f4d1"
}

4. 获取该用户当前Region的Snat列表ListSnatGateway

接口方法:GET

请求示例:

https://open.cn-east-1.163yun.com/vpc?Version=2017-11-30&Action=ListSnatGateway&Limit=5&Offset=1&VpcId=a007fc18-2b71-4aa7-b50f-c1becbdf1e7a 

url 参数:

参数是否必选说明
VersionAPI 版本号
ActionListSnatGateway,获取SNAT网关列表
Limit可选返回个数,不填默认20
Offset可选总偏移量,不填默认0
VpcId可选填写此参数时只返回此VPC的SNAT网关Id

响应示例:

{
    "SnatGateways": [],
    "Count": 1,
    "Offset": 1,
    "RequestId": "a02588a1-f4e7-4ff4-ae03-3e0bf23e214d",
    "Limit": 5
}

5. 变更snat ChangeSnatGateway

接口方法:POST

请求示例:

https://open.cn-east-1.163yun.com/vpc?Version=2017-11-30&Action=ChangeSnatGateway
-d'{
    "Id": "ab90f243-07dd-423f-a6bb-83e7b3391645",
    "Spec": "XS"
}'

url 参数:

参数是否必选说明
VersionAPI 版本号
ActionChangeSnatGateway,更新指定的SNAT网关

body 参数:

参数是否必填说明
Id必选snat的id
Spec必选变更计费类型后,SNAT网关的规格,有微型:XS,标准型:S,中型:M,大型:L,超大型:XL,若不填则默认当前规格
PayType可选目前只支持包年包月PrePay,只在按量转包年包月的时候传,其余按量升配与包年包月升配的时候,不能传该参数
Period可选购买周期,如果PayType为PrePay的话必传 合法取值为1-9,12,24
NetworkChargeType可选网络收费类型,当前仅支持 BANDWIDTH,按量转包年包月(即PayType为PrePay时必传)
InternetBandwidth可选实例实际想使用的带宽,按量转包年包月(即PayType为PrePay),以及包年包月升配时必传,大小不超过该Spec的最大带宽
TerminateMethod可选预付费PrePay实例到期策略,默认PERSIST (到期转按量),DELETE(到期删除)
AutoRenewPeriod可选自动续订时长,默认为0
OrderId可选转包年包月同时变配的订单id

请求举例:

按量实例变更规格(可以升配也可以降配)

{
    "Id":  "f7f6fb3f-bd5c-4b4d-acb6-e2355af4f1ee",       
    "Spec": "XS" 
    ”OrderId":"fc2342343544345834095"  
}

包年包月实例变更SNAT实例的规格(只能升配,即规格和使用带宽只能向上涨,选择了一个更大的规格,带宽也不能调小,可以保持当前规格,但是只调大带宽)

{
    "Id":"f7f6fb3f-bd5c-4b4d-acb6-e2355af4f1ee",   
    "Spec": "XS"                                       
    "InternetBandwidth":30
    ”OrderId":"fc2342343544345834095"
}

按量实例转包年包月实例,同时变更SNAT实例的规格(可以升配也可以降配)

{
    "Id": "f7f6fb3f-bd5c-4b4d-acb6-e2355af4f1ee",  
    "Spec": "XS"  # 转包年包月后的规格,即使规格未变此参数也需要传。
    "PayType":"PrePay",         
    "Period": 1 ,                                  
    "NetworkChargeType":"BANDWIDTH" # 当前仅支持 BANDWIDTH
    "InternetBandwidth":30,
    ”OrderId":"fc2342343544345834095" 【可选】转包年包月同时变配的订单id
}

响应示例:

{
    "SnatGateway": {
        "Id": "ab90f243-07dd-423f-a6bb-83e7b3391645",
        "VpcId": "a007fc18-2b71-4aa7-b50f-c1becbdf1e7a",
        "Spec": "XS",
        "PayType": "PostPaid",
        "Period": 1,
        "NetworkChargeType": "FLOW",
        "InternetBandwidth": 10,
        "Ips": "59.111.149.254,59.111.149.26",
        "Name": "MyVPC-SNAT",
        "Status": "Active",
        "TerminateMethod": "",
        "CreateAt": "2018-11-22T03:28:15Z",
        "UpdateAt": "2018-11-22T06:42:39Z"
    },
    "OrderId": "fc181122144239231238",
    "RequestId": "e9be6132-237d-4376-884f-20f88add7fd0"
}