Dedicated gateway
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. The dedicated gateway service is part of the VPC service and adopts the VPC service domain name.
Retrieve AK/SK
To use Baidu AI Cloud products, you need a Baidu AI Cloud account along with valid AK (Access Key ID) and SK (Secret Access Key) credentials for signature authorization. You can obtain and understand your AK/SK information through the following steps:
Create EtGatewayClient
The EtGatewayClient acts as the client for dedicated gateway services, offering developers various methods to interact with these services. To create an EtGatewayClient, start by configuring an instance of EtGatewayClientConfiguration using Endpoint, AK, and SK, then use this instance to set up the EtGatewayClient. The specific configuration steps are as follows:
1static final String HOST = "";
2static final String AK = "";
3static final String SK = "";
4EtGatewayClientConfiguration config = new EtGatewayClientConfiguration();
5config.setCredentials(new DefaultBceCredentials(ak, sk));
6config.setEndpoint(endpoint);
7EtGatewayClient etGatewayClient = new EtGatewayClient(config);
Create dedicated gateway
Function declaration
1public CreateEtGatewayResponse createEtGateway(CreateEtGatewayRequest request) {
2 ......
3}
Parameter meaning
Please refer to the OpenAPI documentation: Request Parameters for Creating Dedicated Gateway
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "etGatewayId": "dcgw-4ds9x3kmds88"
4}
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, refer to ExampleCreateEtGateway.java
Query dedicated gateway list
Function declaration
1public ListEtGatewayResponse listEtGateways(ListEtGatewayRequest request) {
2 ......
3}
Parameter meaning
Please refer to the OpenAPI documentation Request Parameters for Querying Dedicated Gateway List
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "marker":"dcgw-4ds9x3kmds88",
4 "isTruncated": true,
5 "nextMarker": "dcgw-bi72s924x5xu",
6 "maxKeys": 1,
7 "etGateways":[
8 {
9 "etGatewayId": "dcgw-4ds9x3kmds88",
10 "name": "dcGateway",
11 "status": "running",
12 "speed": 100,
13 "createTime": "2016-03-08T08:13:09Z",
14 "description": "",
15 "vpcId": "vpc-IyrqYIQ7",
16 "etId": "dcphy-478px3km77dh",
17 "channelId": "dedicatedconn-i7c1skfd0djs",
18 "localCidrs": ["192.168.0.0/20"],
19 "enableIpv6": 1,
20 "ipv6LocalCidrs": ["2400:da00:e003:0:15f::/87"]
21 }
22 ]
23}
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, refer to ExampleListEtGateways.java
Query dedicated gateway details
Function declaration
1public GetEtGatewayResponse getEtGateway(String etGatewayId) {
2 ......
3}
Parameter Meaning
Please refer to the OpenAPI documentation Request Parameters for Querying Dedicated Gateway Details
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "etGatewayId":"dcgw-4ds9x3kmds88",
4 "name":"dcGateway",
5 "status":"running",
6 "speed":100,
7 "createTime":"2016-03-08T08:13:09Z",
8 "description":"",
9 "vpcId":"vpc-IyrqYIQ7",
10 "etId":"dcphy-478px3km77dh",
11 "channelId":"dedicatedconn-i7c1skfd0djs",
12 "localCidrs":["192.168.0.0/20"],
13 "enableIpv6": 1,
14 "ipv6LocalCidrs": ["2400:da00:e003:0:15f::/87"],
15 "healthCheckSourceIp":"192.168.5.2",
16 "healthCheckDestIp":"172.16.2.3",
17 "healthCheckType":"ICMP",
18 "healthCheckInterval":2,
19 "healthThreshold":2,
20 "unhealthThreshold":2
21}
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, refer to ExampleGetEtGateway.java
Update dedicated gateway
Function declaration
1public void updateEtGateway(UpdateEtGatewayRequest request) {
2 ......
3}
Parameter meaning
Please refer to the OpenAPI documentation: Request Parameters for Updating Dedicated Gateway
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, refer to ExampleUpdateEtGateway.java
Bind physical dedicated line to dedicated gateway
Function declaration
1public void bindEtChannel(BindEtChannelRequest request) {
2 ......
3}
Parameter Meaning
Please refer to the OpenAPI documentation: Request Parameters for Binding Physical Dedicated Line to Dedicated Gateway
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, refer to ExampleBindEtChannel.java
Unbind physical dedicated line from dedicated gateway
Function declaration
1public void unbindEtChannel(UnbindEtChannelRequest request) {
2 ......
3}
Parameter meaning
Please refer to the OpenAPI documentation: Request Parameters for Unbinding Physical Dedicated Line from Dedicated Gateway
Response value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, refer to ExampleUnbindEtChannel.java
Create health check for dedicated gateway
Function declaration
1public void createEtGatewayHealthCheck(CreateEtGatewayHealthCheckRequest request) {
2 ......
3}
Parameter meaning
Please refer to the OpenAPI documentation: Request Parameters for Creating Health Check for Dedicated Gateway
Response value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, refer to ExampleCreateEtGatewayHealthCheck.java
Release dedicated gateway
Function declaration
1// Do not specify clientToken to delete dedicated gateway, idempotence not supported
2public void deleteEtGateway(String etGatewayId) {
3 ......
4}
5 // Specify clientToken to delete dedicated gateway, idempotence supported
6public void deleteEtGateway(String etGatewayId, String clientToken) {
7 ......
8}
Parameter meaning
Please refer to the OpenAPI documentation: Request Parameters for Releasing Dedicated Gateway
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, refer to ExampleDeleteEtGateway.java
Appendix
Public response information in Metadata format
1 {
2 "bceRequestId":"f5f0821d-45fe-439b-bbf4-fc48b639f84a",
3 "contentLength":28,
4 "contentType":"application/json;charset=UTF-8",
5 "date":1701917695000,
6 "server":"openresty/1.15.8.1"
7 }
