IPv6Gateway
Retrieve Endpoint
Before configuring the endpoint for SDK usage, please refer to the developer guide section on VPC Service Domain Name to understand endpoint-related concepts. Baidu AI Cloud currently supports multiple regions. Please refer to the VPC section in the Region Selection Guide. IPv6 gateway service is part of the VPC service and adopts the VPC service domain name.
Retrieve access key
To use the Baidu AI Cloud products, you need a Baidu AI Cloud account, a valid AK (Access Key ID) and SK (Secret Access Key) for signature certification. Your AK/SK information can be obtained and understood through the following steps:
ipv6gateway_client
ipv6gatewayclient is the Python client for the IPv6 gateway service. It encapsulates the APIs of the IPv6 gateway service, thereby simplifying the interaction between developers and the service. Users can call methods in ipv6gateway_client to configure the IPv6 gateway, and the return parameters of the methods in ipv6gateway_client are consistent with [API Methods](https://console.bce.baidu.com/iam/?=1513940574695#/iam/accesslist).
Create ipv6gateway_client
When creating an ipv6gateway_client, first configure a BceClientConfiguration type config instance using endpoint, AK and SK, and then use the config instance to configure the ipv6gateway_client. The specific configuration method is as follows:
1 HOST = b''
2 AK = b''
3 SK = b''
4 config = BceClientConfiguration(
5 credentials=BceCredentials(AK, SK), endpoint=HOST)
6 self.client = ipv6gateway_client.IPv6GatewayClient(config)
IPv6 gateway management
The IPv6 gateway acts as the primary egress for a virtual private cloud to connect to the public network using IPv6. Users can purchase IPv6 public bandwidth on demand and dynamically configure IPv6 Internet egress and ingress bandwidth by setting egress-only policies and applying IP rate limits.
Create IPv6 gateway
Use the code below to create an IPv6 gateway.
Function declaration
1def create_ipv6_gateway(self, name, vpc_id, bandwidthInMbps, billing=None, client_token=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation:https://cloud.baidu.com/doc/VPC/s/Hkkqieads
Response value
Operation succeeded:
1{
2 "gatewayId":"gw-5af4eb65"
3}
Operation failed:
Throw an exception. For the exception list, refer to IPv6 Gateway Exception List
Code example
For specific code examples, refer to example_create_ipv6_gateway.py
Query IPv6 gateway
Use the code below to query a list of available IPv6 gateways.
Function declaration
1def list_ipv6_gateways(self, vpc_id, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/VPC/s/Dkkqigf0v
Response value
Operation succeeded:
1{
2 "name": "test",
3 "gatewayId": "gw-5af4eb65",
4 "bandwidthInMbps": 10,
5 "vpcId": "vpc-dsi78hfsa",
6 "egressOnlyRules": [
7 {
8 "egressOnlyRuleId":"ipv6_seg-c9e3b428",
9 "cidr":"2400:da00:e003:d01::/64"
10 }
11 ],
12 "rateLimitRules":[
13 {
14 "rateLimitRuleId":"ipv6_qos-0b56ec38",
15 "ipv6Address":"240c:4082:0:100::",
16 "ingressBandwidthInMbps":5,
17 "egressBandwidthInMbps":5
18 }
19 ]
20}
Operation failed:
Throw an exception. For the exception list, refer to IPv6 Gateway Exception List
Code example
For specific code examples, refer to example_list_ipv6_gateway.py
Delete IPv6 gateway
Use the code below to remove a specific IPv6 gateway.
Function declaration
1def delete_ipv6_gateway(self, gateway_id, client_token=None, config=None)
Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/VPC/s/1kkqihc05
Response Value
Operation succeeded:
There are no special response parameters
Operation failed:
Throw an exception. For the exception list, refer to IPv6 Gateway Exception List
Code example
For specific code examples, refer to example_delete_ipv6_gateway.py
Bandwidth resizing for IPv6 gateway
Use the following interface to adjust the bandwidth size for the IPv6 gateway.
Function declaration
1def resize_ipv6_gateway(self, gateway_id, bandwidthInMbps, client_token=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/VPC/s/0kkqiiaaz
Response value
Operation succeeded:
There are no special response parameters
Operation failed:
Throw an exception. For the exception list, refer to IPv6 Gateway Exception List
Code example
For specific code examples, refer to example_resize_ipv6_gateway.py
Add IPv6 egress-only policy
Use the code below to add an egress-only policy for the IPv6 gateway.
Function declaration
1def create_ipv6_gateway_egress_only_rule(self, gateway_id, cidr, client_token=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/VPC/s/jkkqijeky
Response value
Operation succeeded:
1{
2 "egressOnlyRuleId":"ipv6_seg-c9e3b428"
3}
Operation failed:
Throw an exception. For the exception list, refer to IPv6 Gateway Exception List
Code example
For specific code examples, refer to example_create_ipv6_gateway_egress_only_rule.py
Query the IPv6 egress-only policy list
Use the code below to query the list of egress-only policies for the IPv6 gateway.
Function declaration
1def list_ipv6_gateway_egress_only_rules(self, gateway_id, marker=None, max_keys=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/VPC/s/vkkqikkey
Response Value
Operation succeeded:
1{
2 "egressOnlyRules":[
3 {
4 "egressOnlyRuleId":"ipv6_seg-c9e3b428",
5 "cidr":"2400:da00:e003:d01::/64"
6 }
7 ],
8 "marker":"ipv6_seg-c9e3b428",
9 "maxKeys":1000
10 "isTruncated":false
11}
Operation failed:
Throw an exception. For the exception list, refer to IPv6 Gateway Exception List
Code example
For specific code examples, refer to example_list_ipv6_gateway_egress_only_rule.py
Delete the IPv6 egress-only policy
Use the code below to delete an IPv6 egress-only policy.
Function declaration
1def delete_ipv6_gateway_egress_only_rule(self, gateway_id, egress_only_rule_id, client_token=None, config=None)
Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/VPC/s/kkkqily45
Response Value
Operation succeeded:
There are no special response parameters
Operation failed:
Throw an exception. For the exception list, refer to IPv6 Gateway Exception List
Code example
For specific code examples, refer to example_delete_ipv6_gateway_egress_only_rule.py
Create IPv6 gateway bandwidth limiting policy
Use the code below to add a bandwidth limiting policy to an IPv6 address.
Function declaration
1def create_ipv6_gateway_rate_limit_rule(self, gateway_id, ipv6_address,
2 ingress_bandwidthInMbps, egress_bandwidthInMbps,
3 client_token=None, config=None)
Parameter Meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/VPC/s/Akkqimp6y
Response Value
Operation succeeded:
1{
2 "rateLimitRuleId":"ipv6_qos-0b56ec38"
3}
Operation failed:
Throw an exception. For the exception list, refer to IPv6 Gateway Exception List
Code example
For specific code examples, refer to example_create_ipv6_gateway_rate_limit_rule.py
Query IPv6 gateway bandwidth limiting policy list
Use the code below to query the list of bandwidth limiting policies for the IPv6 gateway.
Function declaration
1def list_ipv6_gateway_rate_limit_rules(self, gateway_id, marker=None, max_keys=None, config=None)
Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/VPC/s/lkkqioqpo
Response Value
Operation succeeded:
1{
2 "rateLimitRules":[
3 {
4 "rateLimitRuleId":"ipv6_qos-0b56ec38"
5 "ipv6Address":"240c:4082:0:100::",
6 "ingressBandwidthInMbps":5,
7 "egressBandwidthInMbps":5
8 }
9 ],
10 "marker":"ipv6_qos-0b56ec38",
11 "maxKeys":1000
12 "isTruncated":false
13}
Operation failed:
Throw an exception. For the exception list, refer to IPv6 Gateway Exception List
Code example
For specific code examples, refer to example_list_ipv6_gateway_rate_limit_rule.py
Update IPv6 gateway bandwidth limiting policy
Use the code below to modify an existing bandwidth limiting policy for an IPv6 gateway.
Function declaration
1def update_ipv6_gateway_rate_limit_rule(self, gateway_id, rate_limit_rule_id,
2 ingress_bandwidthInMbps, egress_bandwidthInMbps,
3 client_token=None, config=None)
Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/VPC/s/xkkqincwy
Response Value
Operation succeeded:
There are no special response parameters
Operation failed:
Throw an exception. For the exception list, refer to IPv6 Gateway Exception List
Code example
For specific code examples, refer to example_update_ipv6_gateway_rate_limit_rule.py
Delete IPv6 gateway bandwidth limiting policy
Use the code below to remove a bandwidth limiting policy for an IPv6 gateway.
Function declaration
1def delete_ipv6_gateway_rate_limit_rule(self, gateway_id, rate_limit_rule_id, client_token=None, config=None)
Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/VPC/s/vkkqio03j
Response value
Operation succeeded:
There are no special response parameters
Operation failed:
Throw an exception. For the exception list, refer to IPv6 Gateway Exception List
Code example
For specific code examples, refer to example_delete_ipv6_gateway_rate_limit_rule.py
