Skip to content

Conversation

@wchau
Copy link
Contributor

@wchau wchau commented Sep 23, 2022

Added all configurable flags for create and update operations.
Added unit tests for all CLI commands relevant to the 3 securables.
Added .vscode folder to automatically configure lint and pytest.
Included GCP credentials in preparation for private preview.

Manually tested with a handful of commands.

@wchau wchau self-assigned this Sep 23, 2022
@pietern
Copy link
Contributor

pietern commented Sep 27, 2022

@adamcain-db Could you take a pass?

Copy link
Contributor

@pietern pietern left a comment

Choose a reason for hiding this comment

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

LGTM

@adamcain-db Will defer approval to you. I'll take care of merge and release when done.

Copy link
Contributor

@adamcain-db adamcain-db left a comment

Choose a reason for hiding this comment

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

LGTM. Just some questions about input validation.
Thanks for adding all these flags and also the unit tests!

data = {
'name': name,
'comment': comment
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like we are leaving it completely to the server to validate the input -- e.g., we are not checking that data has required fields like name. I suppose that's reasonable (as we also do not validate JSON inputs), but I wanted to confirm that this is our approach for input validation at the CLI.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's the idea. Instead of replicating the full validation logic, just letting the server do it and then return the error message would make things easier to maintain.

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense.

help='Path URL for the new external location')
@click.option('--storage-credential-name', default=None,
help='Name of storage credential to use with new external location')
@click.option('--read-only/--no-read-only', is_flag=True, default=None,
Copy link
Contributor

Choose a reason for hiding this comment

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

Wow! I'm thrilled that when the data dict has fields like 'read_only': None, the JSON sent has "read_only": null and then the server sees that field omitted. Party on, Garth....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Null magic!

cred_az_application_id, cred_az_client_secret,
cred_az_mi_access_connector_id,
cred_az_mi_id, cred_gcp_sak_email, cred_gcp_sak_private_key_id,
cred_gcp_sak_private_key):
Copy link
Contributor

Choose a reason for hiding this comment

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

No biggie, but I wonder if this CLI should be validate_storage_credential. It still requires a url, of course, but the CLI name would at least match the API endpoint. Eh, just a thought...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I am not sure why it's named differently, but unfortunately, renaming a command is more trouble than it's worth. If we want to, it should be in a different PR with proper deprecation patterns.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed.

@wchau wchau requested a review from pietern September 28, 2022 20:34
'The service account\'s RSA private key.'))
@click.option('--comment', default=None,
help='Free-form text description.')
@create_update_common_options
Copy link
Contributor

Choose a reason for hiding this comment

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

Slick!

@pietern pietern merged commit 81c26a8 into databricks:main Oct 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants