= dmda.DomoTokenAuth(
token_auth =os.environ["DOMO_INSTANCE"],
domo_instance=os.environ["DOMO_ACCESS_TOKEN"],
domo_access_token
)
await token_auth.print_is_token()
🎉 token_auth token retrieved from domo-community ⚙️
True
token_auth = dmda.DomoTokenAuth(
domo_instance=os.environ["DOMO_INSTANCE"],
domo_access_token=os.environ["DOMO_ACCESS_TOKEN"],
)
await token_auth.print_is_token()
🎉 token_auth token retrieved from domo-community ⚙️
True
Role_CRUD_Error (domo_instance, function_name, status, message, role_id=None, parent_class=None)
base exception
Role_NotRetrieved (domo_instance, function_name, status, message, role_id=None, parent_class=None)
base exception
get_roles (auth:domolibrary.client.DomoAuth.DomoAuth, session:httpx.AsyncClient=None, debug_api:bool=False, debug_num_stacks_to_drop:int=1, parent_class:str=None)
id | name | description | authorityCount | userCount | created | modified | |
---|---|---|---|---|---|---|---|
0 | 1 | Admin | Full access to everything | 94 | 29 | 1580425515000 | 1580425515000 |
1 | 2 | Privileged | Full access except for editing users and setti... | 37 | 718 | 1580425515000 | 1580425515000 |
2 | 3 | Editor | Can edit Cards, Pages, DataSets, and Dataflows | 33 | 9 | 1580425515000 | 1580425515000 |
3 | 4 | Participant | Read only access to Cards and Pages | 8 | 7 | 1580425515000 | 1580425515000 |
4 | 5 | Social | Access limited to social features | 2 | 34 | 1580425515000 | 1580425515000 |
get_role_by_id (auth:domolibrary.client.DomoAuth.DomoAuth, role_id:str, session:httpx.AsyncClient=None, debug_api:bool=False, debug_num_stacks_to_drop=1, parent_class:str=None)
ResponseGetData(status=200, response={'id': 1, 'name': 'Admin', 'description': 'Full access to everything', 'authorityCount': 94, 'userCount': 29, 'created': 1580425515000, 'modified': 1580425515000}, is_success=True, parent_class=None)
get_role_grants (auth:domolibrary.client.DomoAuth.DomoAuth, role_id:str, session:httpx.AsyncClient=None, debug_api:bool=False, debug_num_stacks_to_drop=1, parent_class:str=None)
0 | |
---|---|
0 | versions.deployment.manage |
1 | ai.model.create |
2 | buzz.admin |
3 | goal.admin |
4 | dataflow.admin |
get_role_membership (auth:domolibrary.client.DomoAuth.DomoAuth, role_id:str, session:httpx.AsyncClient=None, return_raw:bool=False, debug_api:bool=False, debug_num_stacks_to_drop:int=1, parent_class:str=None)
res = await get_role_membership(auth=token_auth, role_id=1, return_raw=False)
pd.DataFrame(res.response[0:5])
userId | displayName | roleId | department | jobTitle | hireDate | location | ||
---|---|---|---|---|---|---|---|---|
0 | 1345408759 | DataMaven42@gmail.com | Alexis Lorenz (DataMaven) | 1 | Owner | Major Domo Support Specialist | 1.590156e+12 | NaN |
1 | 1102391116 | andrea.henderson@domo.com | Andrea Henderson | 1 | NaN | NaN | NaN | NaN |
2 | 1095515127 | andrew@crystalballers.ai | Andrew Chaffin | 1 | Crystal Ballers | Cofounder | NaN | |
3 | 1865099622 | Ben.Schein@domo.com | Ben Schein | 1 | NaN | NaN | NaN | NaN |
4 | 587894148 | bryan@bvankampen.net | Bryan Van Kampen | 1 | BT Partners | Executive Analytics | 1.588828e+12 | NaN |
create_role (auth:domolibrary.client.DomoAuth.DomoAuth, name:str, description:str, session:httpx.AsyncClient=None, debug_api:bool=False, debug_num_stacks_to_drop:int=1, parent_class:str=None)
delete_role (auth:domolibrary.client.DomoAuth.DomoAuth, role_id:int, session:httpx.AsyncClient=None, debug_api:bool=False, debug_num_stacks_to_drop:int=1, parent_class:str=None, return_raw:bool=False)
role_ls = await get_roles(auth=token_auth)
role = next(
(role for role in role_ls.response if role.get("name") == "test_delete"), None
)
if not role:
role = (
await create_role(
name="test_delete",
description="test_delete",
auth=token_auth,
debug_api=False,
)
).response
print({"new_role": role})
time.sleep(3)
await delete_role(auth=token_auth, role_id=role["id"], debug_api=False)
{'new_role': {'id': 1719013432, 'name': 'test_delete', 'description': 'test_delete'}}
😕 weird API issue, but role should have been deleted. setting is_success = True
ResponseGetData(status=400, response='Bad Request', is_success=True, parent_class=None)
get_default_role (auth, session:httpx.AsyncClient=None, debug_api:bool=False, debug_num_stacks_to_drop:int=1, parent_class:str=None)
ResponseGetData(status=200, response='2', is_success=True, parent_class=None)
set_default_role (auth:domolibrary.client.DomoAuth.DomoAuth, role_id:str, session:httpx.AsyncClient=None, debug_api:bool=False, debug_num_stacks_to_drop:int=1, parent_class=None)
update_role_metadata (auth:domolibrary.client.DomoAuth.DomoAuth, role_id, role_name, role_description:str=None, session:httpx.AsyncClient=None, debug_api:bool=False, debug_num_stacks_to_drop:int=1, parent_class:str=None, return_raw:bool=False)
# import datetime as dt
# get role to update
role_ls = await get_roles(auth=token_auth)
role = next((role for role in role_ls.response if role.get("name") == "test_update_metadata"),None)
if not role:
role = (
await create_role(
name="test_update_metadata",
description="test_update_metadata",
auth=token_auth,
)
).response
# update role
await update_role_metadata(
auth=token_auth,
role_id=role["id"],
role_name=role["name"],
role_description=f"last updated - {dt.date.today()}",
debug_api=False,
)
await get_role_by_id(role_id = role['id'], auth = token_auth)
😕 weird API issue, but role should have been modified. setting is_success = True
ResponseGetData(status=200, response={'id': 108369421, 'name': 'test_update_metadata', 'description': 'last updated - 2024-10-16', 'authorityCount': 4, 'userCount': 0, 'created': 1719866338000, 'modified': 1729112030000}, is_success=True, parent_class=None)
set_role_grants (auth:domolibrary.client.DomoAuth.DomoAuth, role_id:str, role_grant_ls:list[str], session:httpx.AsyncClient=None, debug_api:bool=False, debug_num_stacks_to_drop:int=1, parent_class:str=None, return_raw:bool=False)
role_ls = await get_roles(auth=token_auth)
role = next((role for role in role_ls.response if role.get("name") == "test_update_metadata"),None)
if not role:
role = (
await create_role(
name="test_update_metadata",
description="test_update_metadata",
auth=token_auth,
)
).response
await set_role_grants(
role_id=role["id"],
auth=token_auth,
role_grant_ls=[
"user.edit",
"user.invite",
"user.session.edit",
"versions.repository.admin",
],
)
😕 weird API issue, but role should have been modified. setting is_success = True
ResponseGetData(status=400, response='Bad Request', is_success=True, parent_class=None)
role_membership_add_users (auth:domolibrary.client.DomoAuth.DomoAuth, role_id:str, user_list:list[str], session:httpx.AsyncClient=None, debug_api:bool=False, debug_num_stacks_to_drop:int=1, parent_class:str=None)
Type | Default | Details | |
---|---|---|---|
auth | DomoAuth | ||
role_id | str | ||
user_list | list | list of user ids | |
session | AsyncClient | None | |
debug_api | bool | False | |
debug_num_stacks_to_drop | int | 1 | |
parent_class | str | None | |
Returns | ResponseGetData |