Skip to content

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

Merged
merged 13 commits into from
Jun 16, 2025
Merged

Conversation

Emerald-Z
Copy link
Member

@Emerald-Z Emerald-Z commented Jun 10, 2025

Updated golang sdk to account for data source type

Commands modified: GET, LIST, UPDATE, CREATE

Changes include:

  • modifications of the sdk functions as well as the proto parser
  • additions to the cli to add flags and validation for the action commands
  • tests to verify that command line arguments can be validated for data source type

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!

@Emerald-Z Emerald-Z requested a review from a team as a code owner June 10, 2025 18:47
@Emerald-Z Emerald-Z requested review from njooma and gabegottlob June 10, 2025 18:47
@viambot viambot added the safe to test This pull request is marked safe to test from a trusted zone label Jun 10, 2025
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jun 10, 2025
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jun 10, 2025
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jun 10, 2025
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jun 10, 2025
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jun 10, 2025
Copy link
Member

@gloriacai01 gloriacai01 left a 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

@@ -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,
Copy link
Member

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

Copy link
Member Author

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]",
Copy link
Member

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jun 10, 2025
@viambot viambot removed the safe to test This pull request is marked safe to test from a trusted zone label Jun 10, 2025
@viambot viambot added the safe to test This pull request is marked safe to test from a trusted zone label Jun 10, 2025
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jun 11, 2025
@Emerald-Z Emerald-Z requested a review from gloriacai01 June 11, 2025 19:03
Copy link
Member

@vijayvuyyuru vijayvuyyuru left a 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!


func dataSourceTypeToProto(dataSourceType string) (pb.TabularDataSourceType, error) {
switch dataSourceType {
case "standard":
Copy link
Member

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]",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jun 11, 2025
Copy link
Member

@vijayvuyyuru vijayvuyyuru left a 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!

) error {
mqlBinary, err := queryBSONToBinary(query)
if err != nil {
return err
}

if dataSourceType != TabularDataSourceTypeStandard && dataSourceType != TabularDataSourceTypeHotStorage {
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jun 13, 2025
@Emerald-Z Emerald-Z requested a review from vijayvuyyuru June 13, 2025 15:22
Copy link
Member

@vijayvuyyuru vijayvuyyuru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!!!!

Copy link
Member

@gloriacai01 gloriacai01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

Copy link
Member

@njooma njooma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cli looks good

@Emerald-Z Emerald-Z merged commit bbb0549 into viamrobotics:main Jun 16, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
safe to test This pull request is marked safe to test from a trusted zone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants