Skip to content
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

Add databricks scim command to expose the SCIM api: #311

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

areese
Copy link
Contributor

@areese areese commented Aug 14, 2020

databricks_cli/click_types.py Outdated Show resolved Hide resolved
databricks_cli/scim/api.py Outdated Show resolved Hide resolved
databricks_cli/utils.py Outdated Show resolved Hide resolved
databricks_cli/scim/api.py Outdated Show resolved Hide resolved
databricks_cli/scim/cli.py Show resolved Hide resolved
databricks_cli/scim/exceptions.py Outdated Show resolved Hide resolved
databricks_cli/sdk/api_client.py Outdated Show resolved Hide resolved
areese added 2 commits October 9, 2020 09:21
…development

Fix delete method to only return an empty dict if there was no body in the response.
Copy link
Contributor

@nfx nfx left a comment

Choose a reason for hiding this comment

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

See change requests in context of specific methods.

@@ -62,6 +63,7 @@ def cli():
cli.add_command(secrets_group, name='secrets')
cli.add_command(stack_group, name='stack')
cli.add_command(groups_group, name='groups')
cli.add_command(scim_group, name='scim')
Copy link
Contributor

Choose a reason for hiding this comment

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

can you split scim into two commands - users & groups (groups_group can also be changed). for end users this is what would make the most sense, not SCIM (which is heavily enterprise-admin focused).



class ScimApi(object):
GROUP_NAME_FILTER = 'displayName eq {}'
Copy link
Contributor

Choose a reason for hiding this comment

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

if group name got spaces in it, this condition will fail. please quote it

filters=self.GROUP_NAME_FILTER.format(group_name),
data=content)

def get_group_name_for_group(self, group_id):
Copy link
Contributor

Choose a reason for hiding this comment

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

change to get_group_name_by_id

content = self.list_users(filters=filters)
return content

def get_user_id_for_user(self, user_name):
Copy link
Contributor

Choose a reason for hiding this comment

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

change name to get_user_id_by_name

filters=self.USER_NAME_FILTER.format(user_name),
data=content)

def get_group_id_for_group(self, group_name):
Copy link
Contributor

Choose a reason for hiding this comment

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

change to get_group_id_by_name



@click.command(context_settings=CONTEXT_SETTINGS,
short_help='NOT IMPLEMENTED')
Copy link
Contributor

Choose a reason for hiding this comment

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

please remove or implement

@click.command(context_settings=CONTEXT_SETTINGS,
short_help='List groups')
@click.option('--filters', default=None, required=False, help=FILTERS_HELP)
@click.option('--group-id', metavar='<int>', cls=OptionalOneOfOption, 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.

why not --id and --name - it's already clear from command name it's group or user.

@click.option('--group-name', required=True)
@click.option('--member', 'members', is_flag=False, default=None, metavar='<members>',
type=click.STRING,
help='members to add to the group', multiple=True, required=False)
Copy link
Contributor

Choose a reason for hiding this comment

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

add more docs here - is it --member user.name@example.com --member user2@example.com or it is --member id --member id2.

TBD:
it's preferable to have databricks groups create "Data Science" --user-name ben@example.com --user-name john@example.com --group-name "Data Interns"

@eat_exceptions
@provide_api_client
# pylint:disable=unused-argument
def groups_update_cli(api_client, group_id, operation, path, values):
Copy link
Contributor

Choose a reason for hiding this comment

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

add more semantic commands here. see comment about users.

databricks_cli/scim/cli.py Show resolved Hide resolved
Copy link
Contributor

@nfx nfx left a comment

Choose a reason for hiding this comment

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

See change requests in context of specific methods.

Please also add 85% unit test coverage for new code to match quality assurance criteria for other code in this repo - https://codecov.io/gh/databricks/databricks-cli/tree/master/databricks_cli

@codecov-io
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (master@929ac6e). Click here to learn what that means.
The diff coverage is 54.79%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #311   +/-   ##
=========================================
  Coverage          ?   81.64%           
=========================================
  Files             ?       41           
  Lines             ?     3083           
  Branches          ?        0           
=========================================
  Hits              ?     2517           
  Misses            ?      566           
  Partials          ?        0           
Impacted Files Coverage Δ
databricks_cli/cli.py 0.00% <0.00%> (ø)
databricks_cli/utils.py 85.00% <20.00%> (ø)
databricks_cli/scim/api.py 27.27% <27.27%> (ø)
databricks_cli/scim/cli.py 76.31% <76.31%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 929ac6e...6a30f25. Read the comment docs.

@areese
Copy link
Contributor Author

areese commented Jan 6, 2021

FYI: This is stale, it has semi-useful code but has a lot to be addressed.
I'm going to leave it open, but I'm not sure how fast I'll come back to it.

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