-
Notifications
You must be signed in to change notification settings - Fork 4
[SK-1024] Organization Custom Roles #38
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
Open
ujjawal-sk
wants to merge
5
commits into
main
Choose a base branch
from
scim/org-custom-roles
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
40fefae
[SK-1024] Organization Custom Roles
ujjawal-sk 275a835
[SK-1024] Organization Custom Roles - fix review comments
ujjawal-sk b2be7ec
[SK-1024] Organization Custom Roles - Remove proto
ujjawal-sk d45296f
[SK-1024] Organization Custom Roles - FIx 1
ujjawal-sk 6405836
[SK-1024] Organization Custom Roles - Fix 2
ujjawal-sk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
from typing import Optional, List, Dict | ||
|
||
from scalekit.core import CoreClient | ||
from scalekit.v1.roles.roles_pb2 import * | ||
from scalekit.v1.roles.roles_pb2_grpc import RolesServiceStub | ||
|
||
|
||
class RoleClient: | ||
"""Class definition for Organization Client""" | ||
|
||
def __init__(self, core_client: CoreClient): | ||
""" | ||
Initializer for Role Client | ||
:param core_client : CoreClient Object | ||
:type : ``` obj ``` | ||
:returns | ||
None | ||
""" | ||
self.core_client = core_client | ||
self.role_client = RolesServiceStub( | ||
self.core_client.grpc_secure_channel | ||
) | ||
|
||
def list_organization_roles( | ||
self, organization_id: str | ||
) -> ListOrganizationRolesResponse: | ||
""" | ||
Method to list organization roles | ||
:param organization_id : organization id | ||
:type : ``` str ``` | ||
:returns: | ||
list of organization roles | ||
""" | ||
return self.core_client.grpc_exec( | ||
self.role_client.ListOrganizationRoles.with_call, | ||
ListOrganizationRolesRequest( | ||
org_id=organization_id | ||
), | ||
) | ||
|
||
def create_organization_role( | ||
self, organization_id: str, options: CreateRole | ||
) -> CreateOrganizationRoleResponse: | ||
""" | ||
Method to create role in an organization based on given data | ||
:param organization_id : organization id | ||
:type : ``` str ``` | ||
:param options : Additional details for org role to be created | ||
:type : ``` obj ``` | ||
:returns: | ||
Create Organization Role Response | ||
""" | ||
return self.core_client.grpc_exec( | ||
self.role_client.CreateOrganizationRole.with_call, | ||
CreateOrganizationRoleRequest( | ||
role=options, | ||
org_id=organization_id | ||
), | ||
) | ||
|
||
def update_organization_role( | ||
self, organization_id: str, role_id: str, role: UpdateRole | ||
) -> UpdateOrganizationRoleResponse: | ||
""" | ||
Method to update role in an organization based on given data | ||
:param organization_id : Organization id of the role to update | ||
:type : ``` str ``` | ||
:param role_id : Role id to update | ||
:type : ``` str ``` | ||
:param role : Role object to update | ||
:type : ``` obj ``` | ||
:returns: | ||
Update Organization Role Response | ||
""" | ||
return self.core_client.grpc_exec( | ||
self.role_client.UpdateOrganizationRole.with_call, | ||
UpdateOrganizationRoleRequest( | ||
org_id=organization_id, | ||
id=role_id, | ||
role=role | ||
), | ||
) | ||
|
||
def delete_organization_role( | ||
self, organization_id: str, role_id: str | ||
) -> UpdateOrganizationRoleResponse: | ||
""" | ||
Method to delete role in an organization based on given data | ||
:param organization_id : Organization id of the role to delete | ||
:type : ``` str ``` | ||
:param role_id : Role id to delete | ||
:type : ``` str ``` | ||
:returns: | ||
None | ||
""" | ||
return self.core_client.grpc_exec( | ||
self.role_client.DeleteOrganizationRole.with_call, | ||
DeleteOrganizationRoleRequest( | ||
org_id=organization_id, | ||
id=role_id | ||
), | ||
) | ||
|
||
def get_organization_role( | ||
self, organization_id: str, role_id: str | ||
) -> GetOrganizationRoleResponse: | ||
""" | ||
Method to get role in an organization based on given data | ||
:param organization_id : Organization id of the role to delete | ||
:type : ``` str ``` | ||
:param role_id : Role id to delete | ||
:type : ``` str ``` | ||
:returns: | ||
Get Organization Response | ||
""" | ||
return self.core_client.grpc_exec( | ||
self.role_client.GetOrganizationRole.with_call, | ||
GetOrganizationRoleRequest( | ||
org_id=organization_id, | ||
id=role_id | ||
), | ||
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
from __future__ import annotations | ||
|
||
from google.protobuf import message as _message | ||
from google.protobuf import timestamp_pb2 as _timestamp_pb2 | ||
from google.protobuf.internal import containers as _containers | ||
from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, \ | ||
Union as _Union | ||
Union as _Union, Optional | ||
|
||
|
||
from scalekit.v1.directories.directories_pb2 import DirectoryGroup | ||
|
||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update this doc string too, check if there are any other which are not matching function/class definitions.