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

[ISSUE] groups API uses an outdated endpoint #583

Open
jdavidheiser opened this issue Mar 13, 2024 · 1 comment
Open

[ISSUE] groups API uses an outdated endpoint #583

jdavidheiser opened this issue Mar 13, 2024 · 1 comment

Comments

@jdavidheiser
Copy link

jdavidheiser commented Mar 13, 2024

Description

The SDK is using an outdated preview endpoint for groups management, which does not work with the new public preview feature that allows us to specify group managers who are not workspace admins but who do have access to manage groups.

the SDK uses the URL

/api/2.0/preview/scim/v2/Groups/

while the correct path should be, according to https://docs.databricks.com/api/account/accountgroups/patch

/api/2.0/accounts/{account_id}/scim/v2/Groups for account admins
and
/api/2.0/account/scim/v2/Groups for workspace admins

Reproduction
the following works to update groups:

class GroupsAPI(databricks.sdk.service.iam.GroupsAPI):
    def patch(self,
                id: str,
                *,
                operations = None,
                schemas = None):
        body = {}
        if operations is not None: body['Operations'] = [v.as_dict() for v in operations]
        if schemas is not None: body['schemas'] = [v.value for v in schemas]
        headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
        # this is the only change, I updated the api endpoint
        self._api.do('PATCH', f'/api/2.0/account/scim/v2/Groups/{id}', body=body, headers=headers)

groups_api = GroupsAPI(workspace_client.api_client)
groups_api.patch(
    id=group_id,
    operations=[        
        databricks.sdk.service.iam.Patch(
            op=databricks.sdk.service.iam.PatchOp.ADD,
            value=json.dumps({
                "members": [
                    {
                        "value": user_id
                    }
                ]
            })
        ),
    ]
)

Expected behavior
A clear and concise description of what you expected to happen.

Is it a regression?
Did this work in a previous version of the SDK? If so, which versions did you try?

Debug Logs
The SDK logs helpful debugging information when debug logging is enabled. Set the log level to debug by adding logging.basicConfig(level=logging.DEBUG) to your program, and include the logs here.

Other Information

  • OS: [e.g. macOS]
  • Version: [e.g. 0.1.0]

Additional context
Add any other context about the problem here.

@yb-yu
Copy link

yb-yu commented Mar 18, 2024

I'm experiencing this issue too.

There should be option at override Group api path, or to use API path starts with /api/2.0/account/scim/v2/Groups.

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

No branches or pull requests

2 participants