Querying the APIG Address of a Job

Sample Code

You can use the API to query the APIG access address of a job. Sample code is as follows:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
// Import classes:
import com.huaweicloud.cs.java.v1.client.ApiException;
import com.huaweicloud.cs.java.v1.JobApi;

JobApi apiInstance = new JobApi(apiClient);//apiClient is created when initializing a CS API client.
String xProjectId = "xProjectId_example"; // String | Project ID used for obtaining the token for the project.
Long jobId = 789L; // Long | Job ID.
try {
    JobApigSinksResponse result = apiInstance.getApigSinks(xProjectId, jobId);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling JobApi#getApigSinks");
    System.err.println(e.getResponseBody());
    e.printStackTrace();
}

Parameter Description

Table 1 Parameters

Parameter

Mandatory

Type

Description

xProjectId

Yes

String

Project ID. This parameter is used to obtain the token for the project.

jobId

Yes

Integer

Job ID.

Table 2 Parameters involved in JobApigSinksResponse

Parameter

Mandatory

Type

Description

messageId

No

String

Message type ID.

message

No

String

Message content.

currentTime

No

Integer

Current time, expressed by milliseconds.

payload

No

-

For details about parameter types, see Table 3.

Table 3 Parameters involved in JobApigSinks

Parameter

Mandatory

Type

Description

sinks

No

List<JobApigSinkEntity>

For details about parameter types, see Table 4.

metadata

No

List<JobMetaDataEntity>

For details about parameter types, see Table 5.

Table 4 Parameters involved in JobApigSinkEntity

Parameter

Mandatory

Type

Description

appId

No

String

ID of the application created on the APIG management console.

sinkName

No

String

Name of a sink stream.

url

No

String

Address of the API created for accessing APIG.

Table 5 Parameters involved in JobMetaDataEntity

Parameter

Mandatory

Type

Description

name

No

String

Name of a sink stream.

encode

No

String

Format of the sink stream data.

delimiter

No

String

Delimiter of the sink stream data.

attrs

No

List<JobMetaDataAttrEntity>

Name and type of each field in the sink stream. For details about parameter types, see Table 6.

Table 6 Parameters involved in JobMetaDataAttrEntity

Parameter

Mandatory

Type

Description

name

No

String

Field name.

type

No

String

Field type