Network probe
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 probe 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 ProbeClient
The ProbeClient serves as the client for the probe service, offering developers various methods to interact with the service. To create a new ProbeClient, you must first configure a BceClientConfiguration-type config instance using Endpoint, AK, and SK. Then, use this configuration instance to set up the ProbeClient. The specific configuration process is outlined below:
1static final String HOST = "";
2static final String AK = "";
3static final String SK = "";
4BceClientConfiguration config = new BceClientConfiguration();
5config.setCredentials(new DefaultBceCredentials(ak, sk));
6config.setEndpoint(endpoint);
7ProbeClient probeClient = new ProbeClient(config);
Create Network Probe
Function declaration
1public CreateProbeResponse createProbe(CreateProbeRequest request)
2 ......
3}
Parameter meaning
Refer to the OpenAPI documentation: Request Parameters for Creating Probe
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "probeId": "probe-s2kyrsdnvk287ziu"
4}
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, refer to ExampleCreateProbe.java
Query network probe list.
Function declaration
1public ListProbeResponse listProbes(ListProbeRequest request) {
2 ......
3}
Parameter meaning
Refer to the OpenAPI documentation: Request Parameters for Querying Probe List
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "nextMarker": "probe-68sfxk5ihf85hjs",
4 "marker": "probe-6gfqbgfypumvmyh0",
5 "maxKeys": 1,
6 "isTruncated": true,
7 "probes": [
8 {
9 "description":"dsdsds",
10 "destIp":"1.2.3.4",
11 "destPort":11,
12 "frequency":20,
13 "name":"probe1",
14 "payload":"qqqqqqwwwww",
15 "probeId":"probe-6gfqbgfypumvmyh0",
16 "protocol":"UDP",
17 "sourceIps":[
18 "192.168.0.4"
19 ],
20 "status":"active",
21 "subnetId":"sbn-qz55vemw0n40",
22 "vpcId":"vpc-2pa2x0bjt26i"
23 }
24 ]
25}
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, refer to ExampleListProbe.java
Query network probe details
Function declaration
1public GetProbeResponse getProbe(String probeId) {
2 ......
3}
Parameter Meaning
Refer to the OpenAPI documentation: Request Parameters for Querying Probe Details
Response Value
- Operation succeeded
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3 "probeId":"probe-6gfqbgfypumvmyh0",
4 "description":"dsdsds",
5 "destIp":"1.2.3.4",
6 "destPort":11,
7 "frequency":20,
8 "name":"probe1",
9 "payload":"qqqqqqwwwww",
10 "protocol":"UDP",
11 "sourceIps":[
12 "192.168.0.4"
13 ],
14 "status":"active",
15 "subnetId":"sbn-qz55vemw0n40",
16 "vpcId":"vpc-2pa2x0bjt26i"
17}
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, refer to ExampleGetProbe.java
Update probe
Function declaration
1public void updateProbe(UpdateProbeRequest request) {
2 ......
3}
Parameter meaning
Refer to the OpenAPI documentation: Request Parameters for Updating Probe
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 ExampleUpdateProbe.java
Delete network probe
Function declaration
1// Do not specify clientToken to delete probe, idempotence not supported
2public void deleteProbe(String probeId) {
3 ......
4}
5 // Specify clientToken to delete probe, idempotence supported
6public void deleteProbe(String probeId, String clientToken) {
7 ......
8}
Parameter Meaning
Refer to the OpenAPI documentation: Request Parameters for Deleting Probe
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 ExampleDeleteProbe.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 }
