@@ -58,19 +58,22 @@ func InstallDataStreamPipelines(ctx context.Context, api *elasticsearch.API, dat
58
58
nonce := time .Now ().UnixNano ()
59
59
60
60
mainPipeline := getPipelineNameWithNonce (dataStreamManifest .GetPipelineNameOrDefault (), nonce )
61
- pipelines , err := loadIngestPipelineFiles (dataStreamPath , nonce )
61
+ pipelines , err := LoadIngestPipelineFiles (dataStreamPath , nonce )
62
62
if err != nil {
63
63
return "" , nil , fmt .Errorf ("loading ingest pipeline files failed: %w" , err )
64
64
}
65
65
66
- err = installPipelinesInElasticsearch (ctx , api , pipelines )
66
+ err = InstallPipelinesInElasticsearch (ctx , api , pipelines )
67
67
if err != nil {
68
68
return "" , nil , err
69
69
}
70
70
return mainPipeline , pipelines , nil
71
71
}
72
72
73
- func loadIngestPipelineFiles (dataStreamPath string , nonce int64 ) ([]Pipeline , error ) {
73
+ // LoadIngestPipelineFiles returns the set of pipelines found in the directory
74
+ // elasticsearch/ingest_pipeline under the provided data stream path. The names
75
+ // of the pipelines are decorated with the provided nonce.
76
+ func LoadIngestPipelineFiles (dataStreamPath string , nonce int64 ) ([]Pipeline , error ) {
74
77
elasticsearchPath := filepath .Join (dataStreamPath , "elasticsearch" , "ingest_pipeline" )
75
78
76
79
var pipelineFiles []string
@@ -241,7 +244,9 @@ func convertValue(value interface{}, label string) ([]string, error) {
241
244
}
242
245
}
243
246
244
- func installPipelinesInElasticsearch (ctx context.Context , api * elasticsearch.API , pipelines []Pipeline ) error {
247
+ // InstallPipelinesInElasticsearch installs the provided pipelines into the
248
+ // Elasticsearch instance specified by the provided API handle.
249
+ func InstallPipelinesInElasticsearch (ctx context.Context , api * elasticsearch.API , pipelines []Pipeline ) error {
245
250
for _ , p := range pipelines {
246
251
if err := installPipeline (ctx , api , p ); err != nil {
247
252
return err
0 commit comments