Call DeleteDataPipelineConfiguration by using OSS Go SDK V2 to delete a specified data pipeline (DataPipeline) rule. You can delete a rule that is in the initializing, paused, or failed state.
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.DeleteDataPipelineConfiguration(context.TODO(), &dataprocess.DeleteDataPipelineConfigurationRequest{
DataPipelineName: oss.Ptr(dataPipelineName),
})
if err != nil {
log.Fatalf("failed to delete pipeline configuration %v", err)
}
log.Printf("delete pipeline configuration result:%#v\n", result)
}
References
For the complete sample code, see delete_data_pipeline_configuration.go.
该文章对您有帮助吗?