Parameter Template
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 network product VPC section in Region Selection Guide.
Note: Subnet API supports both HTTP and HTTPS calling methods. To enhance data security, it is recommended to call via HTTPS.
Retrieve AK/SK
To use the subnets of Baidu AI Cloud, you must have a valid AK (Access Key ID) and SK (Secret Access Key) for signature authentication. AK/SK are system-generated strings that verify users and ensure secure access to services. You can obtain and manage your AK/SK using the following steps:
Create IpCollectionClient
IpCollectionClient, which provides developers with a series of methods to interact with the IpCollection service. When creating an IpCollectionClient, first configure a BCE client configuration-type config instance using endpoint, AK and SK, and then use the config instance to configure the SubnetClient. The specific configuration method is as follows:
1static final String ENDPOINT = ""
2static final String AK = "";
3static final String SK = "";
4IpCollectionClientConfiguration config = new IpCollectionClientConfiguration();
5config.setCredentials(new DefaultBceCredentials(AK, SK));
6config.setEndpoint(ENDPOINT);
7IpCollectionClient ipCollectionClient = new IpCollectionClient(config);
Create IP address set
Function declaration
1public CreateIpAddressSetResponse createIpAddressSet(CreateIpAddressSetRequest request) {
2}
Parameter Meaning
Please refer to the OpenAPI documentation Request Parameters for Creating IP Address Group
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "ipSetId":"ips-zq8i7q57ubxd"
4}
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Code example
For specific code examples, refer to ExampleCreateIpAddressSet.java
Add IP addresses to the IP address group
Function declaration
1public void addIpAddressToIpSet(AddIpAddressToIpSetRequest request) {
2}
Parameter Meaning
Please refer to the OpenAPI documentation Request Parameters for Adding IP Address to IP Address Group
Response Value
-
Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Code example
For specific code examples, refer to ExampleAddIpAddressToIpSet.java
Delete IP address from IP address group
Function declaration
1public void removeIpAddressFromIpSet(RemoveIpAddressFromIpSetRequest request) {
2}
Parameter Meaning
Please refer to the OpenAPI documentation Request Parameters for Deleting IP Address from IP Address Group
Response Value
-
Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Code example
For specific code examples, refer to ExampleRemoveIpAddressFromIpSet.java
Update IP address set
Function declaration
1public void updateIpSet(UpdateIpSetRequest request) {
2}
Parameter Meaning
Please refer to the OpenAPI documentation Request Parameters for Updating IP Address Group
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Code example
For specific code examples, refer to ExampleUpdateIpSet.java
Delete IP address set
Function declaration
1public void deleteIpSet(DeleteIpSetRequest request) {
2}
Parameter Meaning
Please refer to the OpenAPI documentation Request Parameters for Deleting IP Address Group
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Code example
For specific code examples, refer to ExampleDeleteIpSet.java
Query IP address group list
Function declaration
1public QueryIpSetListResponse queryIpSetList(QueryIpSetListRequest request) {
2}
Parameter Meaning
Please refer to the OpenAPI documentation Request Parameters for Querying IP Address Group List
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "ipSets": [{
4 "ipSetId": "ips-w2d4kgc3x0y1",
5 "name": "test_ipSet",
6 "description": "",
7 "ipVersion": "IPv4",
8 "ipAddressInfo": [{
9 "ipAddress": "10.101.151.17",
10 "description": "ip address description"
11 }],
12 "bindedInstanceNum": 3
13 }],
14 "marker": "ips-w2d4kgc3x0y1",
15 "isTruncated": true,
16 "nextMarker": "ips-sd57mmq4irn7",
17 "maxKeys": 1
18}
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Code example
For specific code examples, refer to ExampleQueryIpSetList.java
Query specified IP address group
Function declaration
1QueryIpSetDetailResponse queryIpSetDetail(QueryIpSetDetailRequest request) {
2}
Parameter meaning
Please refer to the OpenAPI documentation Request Parameters for Querying Specified IP Address Group
Response value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "ipSet": "ips-w2d4kgc3x0y1",
4 "name": "test_ipSet",
5 "description": "",
6 "ipVersion": "IPv4",
7 "ipAddressInfo": [{
8 "ipAddress": "10.101.151.17",
9 "description": "ip address description"
10 }],
11 "bindedInstances": [{
12 "instanceId": "esg-w2kmnu1peqxg",
13 "instanceType": "ESG"
14 },
15 {
16 "instanceId": "esg-7c9yzhkfn9c2",
17 "instanceType": "ESG"
18 }
19 ]
20}
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Code example
For specific code examples, refer to ExampleQueryIpSetDetail.java
Create IP address family
Function declaration
1public CreateIpAddressGroupResponse createIpAddressGroup(CreateIpAddressGroupRequest request) {
2}
Parameter Meaning
Please refer to the OpenAPI documentation Request Parameters for Creating IP Address Family
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "ipGroupId":"ipg-pcpvtee8kd6b"
4}
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Code example
For specific code examples, refer to ExampleCreateIpAddressGroup.java
Add IP addresses to the IP address family
Function declaration
1public void bindIpSet(BindIpSetRequest request) {
2}
Parameter Meaning
Please refer to the OpenAPI documentation Request Parameters for Adding IP Address Group to IP Address Family
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Code example
For specific code examples, refer to ExampleBindIpSet.java
Remove IP address group from IP address family
Function declaration
1public void unBindIpSet(UnBindIpSetRequest request) {
2}
Parameter Meaning
Please refer to the OpenAPI documentation Request Parameters for Removing IP Address Group from IP Address Family
Response value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Code example
For specific code examples, refer to ExampleUnBindIpSet.java
Update IP address family
Function declaration
1public void updateIpGroup(UpdateIpGroupRequest request) {
2}
Parameter meaning
Please refer to the OpenAPI documentation Request Parameters for Updating IP Address Family
Response value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Code example
For specific code examples, refer to ExampleUpdateIpGroup.java
Delete IP address family
Function declaration
1public void deleteIpGroup(DeleteIpGroupRequest request) {
2}
Parameter meaning
Please refer to the OpenAPI documentation Request Parameters for Deleting IP Address Family
Response value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Code example
For specific code examples, refer to ExampleDeleteIpGroup.java
Query IP address family list
Function declaration
1public QueryIpGroupListResponse queryIpGroupList(QueryIpGroupListRequest request) {
2}
Parameter meaning
Please refer to the OpenAPI documentation Request Parameters for Querying IP Address Family List
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "ipGroups": [{
4 "ipGroupId": "ipg-w2d4kgc3x0y1",
5 "name": "test_ipGroup",
6 "description": "",
7 "ipVersion": "IPv4",
8 "ipSetIds": ["ips-rpight2b8866"],
9 "bindedInstanceNum": 3
10 }],
11 "marker": "ipg-w2d4kgc3x0y1",
12 "isTruncated": true,
13 "nextMarker": "ipg-sd57mmq4irn7",
14 "maxKeys": 1
15}
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Code example
For specific code examples, refer to ExampleQueryIpGroupList.java
Query specified IP address family
Function declaration
1public QueryIpGroupDetailResponse queryIpGroupDetail(QueryIpGroupDetailRequest request) {
2}
Parameter Meaning
Please refer to the OpenAPI documentation Request Parameters for Querying Specified IP Address Family
Response value
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "ipGroupId": "ipg-w2d4kgc3x0y1",
4 "name": "test_ipGroup",
5 "description": "",
6 "ipVersion": "IPv4",
7 "ipSetIds": ["ips-sd57mmq4irn7"],
8 "bindedInstances": [{
9 "instanceId": "esg-w2kmnu1peqxg",
10 "instanceType": "ESG"
11 },
12 {
13 "instanceId": "esg-7c9yzhkfn9c2",
14 "instanceType": "ESG"
15 }
16 ]
17}
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Code example
For specific code examples, refer to ExampleQueryIpGroupDetail.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 }
