Skip to content

Commit 52a8694

Browse files
authored
DATA-4448: Remove UpdateDataPipeline from CLI/SDK (#5201)
1 parent df6eba9 commit 52a8694

File tree

4 files changed

+0
-142
lines changed

4 files changed

+0
-142
lines changed

app/data_client.go

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,26 +1396,6 @@ func (d *DataClient) CreateDataPipeline(
13961396
return resp.Id, nil
13971397
}
13981398

1399-
// UpdateDataPipeline updates a data pipeline configuration by its ID.
1400-
func (d *DataClient) UpdateDataPipeline(
1401-
ctx context.Context, id, name string, query []map[string]interface{}, schedule string, dataSourceType TabularDataSourceType,
1402-
) error {
1403-
mqlBinary, err := queryBSONToBinary(query)
1404-
if err != nil {
1405-
return err
1406-
}
1407-
1408-
dataSourceTypeProto := dataSourceTypeToProto(dataSourceType)
1409-
_, err = d.datapipelinesClient.UpdateDataPipeline(ctx, &datapipelinesPb.UpdateDataPipelineRequest{
1410-
Id: id,
1411-
Name: name,
1412-
MqlBinary: mqlBinary,
1413-
Schedule: schedule,
1414-
DataSourceType: &dataSourceTypeProto,
1415-
})
1416-
return err
1417-
}
1418-
14191399
// DeleteDataPipeline deletes a data pipeline by its ID.
14201400
func (d *DataClient) DeleteDataPipeline(ctx context.Context, id string) error {
14211401
_, err := d.datapipelinesClient.DeleteDataPipeline(ctx, &datapipelinesPb.DeleteDataPipelineRequest{

app/data_client_test.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,21 +1158,6 @@ func TestDataPipelineClient(t *testing.T) {
11581158
test.That(t, resp, test.ShouldEqual, "new-data-pipeline-id")
11591159
})
11601160

1161-
t.Run("UpdateDataPipeline", func(t *testing.T) {
1162-
grpcClient.UpdateDataPipelineFunc = func(
1163-
ctx context.Context, in *datapipelinesPb.UpdateDataPipelineRequest, opts ...grpc.CallOption,
1164-
) (*datapipelinesPb.UpdateDataPipelineResponse, error) {
1165-
test.That(t, in.Id, test.ShouldEqual, dataPipelineID)
1166-
test.That(t, in.Name, test.ShouldEqual, name)
1167-
test.That(t, in.MqlBinary, test.ShouldResemble, mqlBinary)
1168-
test.That(t, in.Schedule, test.ShouldEqual, "0 7 * * *")
1169-
test.That(t, *in.DataSourceType, test.ShouldEqual, pb.TabularDataSourceType_TABULAR_DATA_SOURCE_TYPE_STANDARD)
1170-
return &datapipelinesPb.UpdateDataPipelineResponse{}, nil
1171-
}
1172-
err := client.UpdateDataPipeline(context.Background(), dataPipelineID, name, mqlQueries, "0 7 * * *", TabularDataSourceTypeStandard)
1173-
test.That(t, err, test.ShouldBeNil)
1174-
})
1175-
11761161
t.Run("DeleteDataPipeline", func(t *testing.T) {
11771162
grpcClient.DeleteDataPipelineFunc = func(
11781163
ctx context.Context, in *datapipelinesPb.DeleteDataPipelineRequest, opts ...grpc.CallOption,

cli/app.go

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,48 +1676,6 @@ var app = &cli.App{
16761676
},
16771677
Action: createCommandWithT[datapipelineCreateArgs](DatapipelineCreateAction),
16781678
},
1679-
{
1680-
Name: "update",
1681-
Usage: "update a data pipeline",
1682-
UsageText: createUsageText("datapipelines update",
1683-
[]string{generalFlagID, generalFlagName, datapipelineFlagSchedule}, false, false,
1684-
fmt.Sprintf("[--%s=<%s> | --%s=<%s>]",
1685-
datapipelineFlagMQL, datapipelineFlagMQL,
1686-
datapipelineFlagMQLFile, datapipelineFlagMQLFile),
1687-
),
1688-
Flags: []cli.Flag{
1689-
&cli.StringFlag{
1690-
Name: generalFlagID,
1691-
Usage: "ID of the data pipeline to update",
1692-
Required: true,
1693-
},
1694-
&cli.StringFlag{
1695-
Name: generalFlagName,
1696-
Usage: "name of the data pipeline to update",
1697-
},
1698-
&cli.StringFlag{
1699-
Name: datapipelineFlagSchedule,
1700-
Usage: "schedule of the data pipeline to update (cron expression)",
1701-
},
1702-
&cli.StringFlag{
1703-
Name: datapipelineFlagMQL,
1704-
Usage: "MQL query for the data pipeline to update",
1705-
},
1706-
&cli.StringFlag{
1707-
Name: datapipelineFlagMQLFile,
1708-
Usage: "path to JSON file containing MQL query for the data pipeline to update",
1709-
},
1710-
&cli.StringFlag{
1711-
Name: datapipelineFlagDataSourceType,
1712-
Usage: formatAcceptedValues(
1713-
"data source type for the data pipeline to update",
1714-
StandardDataSourceType,
1715-
HotStorageDataSourceType,
1716-
),
1717-
},
1718-
},
1719-
Action: createCommandWithT[datapipelineUpdateArgs](DatapipelineUpdateAction),
1720-
},
17211679
{
17221680
Name: "delete",
17231681
Usage: "delete a data pipeline",

cli/datapipelines.go

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -112,71 +112,6 @@ func DatapipelineCreateAction(c *cli.Context, args datapipelineCreateArgs) error
112112
return nil
113113
}
114114

115-
type datapipelineUpdateArgs struct {
116-
ID string
117-
Name string
118-
Schedule string
119-
MQL string
120-
MqlPath string
121-
DataSourceType string
122-
}
123-
124-
// DatapipelineUpdateAction updates an existing data pipeline.
125-
func DatapipelineUpdateAction(c *cli.Context, args datapipelineUpdateArgs) error {
126-
client, err := newViamClient(c)
127-
if err != nil {
128-
return err
129-
}
130-
131-
resp, err := client.datapipelinesClient.GetDataPipeline(context.Background(), &datapipelinespb.GetDataPipelineRequest{
132-
Id: args.ID,
133-
})
134-
if err != nil {
135-
return fmt.Errorf("error getting data pipeline: %w", err)
136-
}
137-
current := resp.GetDataPipeline()
138-
139-
name := args.Name
140-
if name == "" {
141-
name = current.GetName()
142-
}
143-
144-
schedule := args.Schedule
145-
if schedule == "" {
146-
schedule = current.GetSchedule()
147-
}
148-
149-
mqlBinary := current.GetMqlBinary()
150-
if args.MQL != "" || args.MqlPath != "" {
151-
mqlBinary, err = parseMQL(args.MQL, args.MqlPath)
152-
if err != nil {
153-
return err
154-
}
155-
}
156-
157-
dataSourceType := current.GetDataSourceType()
158-
if args.DataSourceType != "" {
159-
dataSourceType, err = dataSourceTypeToProto(args.DataSourceType)
160-
if err != nil {
161-
return err
162-
}
163-
}
164-
165-
_, err = client.datapipelinesClient.UpdateDataPipeline(context.Background(), &datapipelinespb.UpdateDataPipelineRequest{
166-
Id: args.ID,
167-
Name: name,
168-
Schedule: schedule,
169-
MqlBinary: mqlBinary,
170-
DataSourceType: &dataSourceType,
171-
})
172-
if err != nil {
173-
return fmt.Errorf("error updating data pipeline: %w", err)
174-
}
175-
176-
printf(c.App.Writer, "%s (id: %s) updated.", name, args.ID)
177-
return nil
178-
}
179-
180115
type datapipelineDeleteArgs struct {
181116
ID string
182117
}

0 commit comments

Comments
 (0)