[DEPRECATED] Create Pipeline
Deprecated
client.Pipelines.New(ctx, params) (*PipelineNewResponse, error)
POST/accounts/{account_id}/pipelines
[DEPRECATED] Create a new pipeline. Use the new /pipelines/v1/pipelines endpoint instead.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Example:
API Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
Example:
The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
Example:
Accepted Permissions (at least one required)
[DEPRECATED] Create Pipeline
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/pipelines"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
pipeline, err := client.Pipelines.New(context.TODO(), pipelines.PipelineNewParams{
AccountID: cloudflare.F("0123105f4ecef8ad9ca31a8372d0c353"),
Destination: cloudflare.F(pipelines.PipelineNewParamsDestination{
Batch: cloudflare.F(pipelines.PipelineNewParamsDestinationBatch{
}),
Compression: cloudflare.F(pipelines.PipelineNewParamsDestinationCompression{
}),
Credentials: cloudflare.F(pipelines.PipelineNewParamsDestinationCredentials{
AccessKeyID: cloudflare.F("<access key id>"),
Endpoint: cloudflare.F("https://123f8a8258064ed892a347f173372359.r2.cloudflarestorage.com"),
SecretAccessKey: cloudflare.F("<secret key>"),
}),
Format: cloudflare.F(pipelines.PipelineNewParamsDestinationFormatJson),
Path: cloudflare.F(pipelines.PipelineNewParamsDestinationPath{
Bucket: cloudflare.F("bucket"),
}),
Type: cloudflare.F(pipelines.PipelineNewParamsDestinationTypeR2),
}),
Name: cloudflare.F("sample_pipeline"),
Source: cloudflare.F([]pipelines.PipelineNewParamsSourceUnion{pipelines.PipelineNewParamsSourceCloudflarePipelinesWorkersPipelinesHTTPSource{
Format: cloudflare.F(pipelines.PipelineNewParamsSourceCloudflarePipelinesWorkersPipelinesHTTPSourceFormatJson),
Type: cloudflare.F("type"),
}}),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", pipeline.ID)
}
{
"result": {
"id": "123f8a8258064ed892a347f173372359",
"destination": {
"batch": {
"max_bytes": 1000,
"max_duration_s": 0.25,
"max_rows": 100
},
"compression": {
"type": "gzip"
},
"format": "json",
"path": {
"bucket": "bucket",
"filename": "${slug}${extension}",
"filepath": "${date}/${hour}",
"prefix": "base"
},
"type": "r2"
},
"endpoint": "https://123f8a8258064ed892a347f173372359.pipelines.cloudflare.com",
"name": "sample_pipeline",
"source": [
{
"format": "json",
"type": "type",
"authentication": true,
"cors": {
"origins": [
"*"
]
}
}
],
"version": 2
},
"success": true
}Returns Examples
{
"result": {
"id": "123f8a8258064ed892a347f173372359",
"destination": {
"batch": {
"max_bytes": 1000,
"max_duration_s": 0.25,
"max_rows": 100
},
"compression": {
"type": "gzip"
},
"format": "json",
"path": {
"bucket": "bucket",
"filename": "${slug}${extension}",
"filepath": "${date}/${hour}",
"prefix": "base"
},
"type": "r2"
},
"endpoint": "https://123f8a8258064ed892a347f173372359.pipelines.cloudflare.com",
"name": "sample_pipeline",
"source": [
{
"format": "json",
"type": "type",
"authentication": true,
"cors": {
"origins": [
"*"
]
}
}
],
"version": 2
},
"success": true
}