Call GetDataPipelineConfiguration by using OSS Go SDK V2 to query the configuration details and running status of a specified data pipeline (DataPipeline) rule.
Prerequisites
OSS Go SDK V2 is installed. You can install it by running
go get github.com/aliyun/alibabacloud-oss-go-sdk-v2.Access credentials are configured through environment variables. The examples in this topic use
credentials.NewEnvironmentVariableCredentialsProvider()to read credentials from theOSS_ACCESS_KEY_IDandOSS_ACCESS_KEY_SECRETenvironment variables.
Sample code
package main
import (
"context"
"log"
"github.com/aliyun/alibabacloud-oss-go-sdk-v2/oss"
"github.com/aliyun/alibabacloud-oss-go-sdk-v2/oss/credentials"
"github.com/aliyun/alibabacloud-oss-go-sdk-v2/oss/dataprocess"
)
func main() {
region := "cn-hangzhou"
dataPipelineName := "my-data-pipeline"
cfg := oss.LoadDefaultConfig().
WithCredentialsProvider(credentials.NewEnvironmentVariableCredentialsProvider()).
WithRegion(region)
client := dataprocess.NewClient(cfg)
result, err := client.GetDataPipelineConfiguration(context.TODO(), &dataprocess.GetDataPipelineConfigurationRequest{
DataPipelineName: oss.Ptr(dataPipelineName),
})
if err != nil {
log.Fatalf("failed to get pipeline configuration %v", err)
}
log.Printf("get pipeline configuration result:%#v\n", result)
}
References
For the complete sample code, see get_data_pipeline_configuration.go.
该文章对您有帮助吗?