-
Notifications
You must be signed in to change notification settings - Fork 122
DATA 4228: Update SDKs and CLI #5044
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
really great work! left a couple small comments
app/data_client.go
Outdated
@@ -1364,18 +1378,24 @@ func (d *DataClient) CreateDataPipeline( | |||
|
|||
// UpdateDataPipeline updates a data pipeline configuration by its ID. | |||
func (d *DataClient) UpdateDataPipeline( | |||
ctx context.Context, id, name string, query []map[string]interface{}, schedule string, | |||
ctx context.Context, id, name string, query []map[string]interface{}, schedule string, opts *CreateDataPipelineOptions, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we shouldn't wrap this in the opts struct bc this isn't optional for Update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense!
cli/app.go
Outdated
@@ -1654,6 +1655,10 @@ var app = &cli.App{ | |||
Name: datapipelineFlagMQLFile, | |||
Usage: "path to JSON file containing MQL query for the new data pipeline", | |||
}, | |||
&cli.StringFlag{ | |||
Name: datapipelineFlagDataSourceType, | |||
Usage: "data source type for the new data pipeline. Allowed values: [standard, hotstorage]", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[super nit] to follow the rest of the cli, lets use formatAcceptedValues
function when outputting the allowed values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super nice work Emerald!
cli/datapipelines.go
Outdated
|
||
func dataSourceTypeToProto(dataSourceType string) (pb.TabularDataSourceType, error) { | ||
switch dataSourceType { | ||
case "standard": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] lets move this to be vars instead of defining them here and reuse them
cli/app.go
Outdated
@@ -1654,6 +1655,10 @@ var app = &cli.App{ | |||
Name: datapipelineFlagMQLFile, | |||
Usage: "path to JSON file containing MQL query for the new data pipeline", | |||
}, | |||
&cli.StringFlag{ | |||
Name: datapipelineFlagDataSourceType, | |||
Usage: "data source type for the new data pipeline. Allowed values: [standard, hotstorage]", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last comment, then we're good to go!
app/data_client.go
Outdated
) error { | ||
mqlBinary, err := queryBSONToBinary(query) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
if dataSourceType != TabularDataSourceTypeStandard && dataSourceType != TabularDataSourceTypeHotStorage { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets remove this check. We usually want the SDK to be as light weight as possible and let app handle a check like this. This check already happens there anyway so we can just remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!!!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cli looks good
Updated golang sdk to account for data source type
Commands modified: GET, LIST, UPDATE, CREATE
Changes include:
note: currently in the cli, dataSourceType is optional in the sense that if you only want to modify other fields, when the update request goes through the original dataSourceType doesn't change. If this doesn't match the spec I can change it!