Skip to content

Commit

Permalink
Merge branch 'main' of github.com:databricks/databricks-sdk-py into g…
Browse files Browse the repository at this point in the history
…en-sdk-22April
  • Loading branch information
tanmay-db committed Apr 23, 2024
2 parents 577a80e + a3c0207 commit e838415
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions examples/groups/patch_groups.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import time
from databricks.sdk import WorkspaceClient
from databricks.sdk.service import iam

w = WorkspaceClient()

group = w.groups.create(display_name=f'sdk-{time.time_ns()}-group')
user = w.users.create(
display_name=f'sdk-{time.time_ns()}-user', user_name=f'sdk-{time.time_ns()}@example.com')

w.groups.patch(
id=group.id,
operations=[iam.Patch(
op=iam.PatchOp.ADD,
value={"members": [{
"value": user.id,
}]},
)],
schemas=[iam.PatchSchema.URN_IETF_PARAMS_SCIM_API_MESSAGES_2_0_PATCH_OP],
)

# cleanup
w.users.delete(id=user.id)
w.groups.delete(id=group.id)

0 comments on commit e838415

Please sign in to comment.