domolibrary
Advanced tools
| # AUTOGENERATED! DO NOT EDIT! File to edit: ../../nbs/classes/50_DomoIntegration.ipynb. | ||
| # %% auto 0 | ||
| __all__ = ['CloudAmplifier_PollingSchedule', 'CloudAmplifier_Warehouse', 'DomoIntegration_OwnerEntity', | ||
| 'DomoIntegration_PropertyConfig', 'DomoIntegration'] | ||
| # %% ../../nbs/classes/50_DomoIntegration.ipynb 2 | ||
| from domolibrary.client.DomoEntity import DomoEntity, DomoEntity_w_Lineage | ||
| import domolibrary.client.DomoAuth as dmda | ||
| import domolibrary.client.DomoError as dmde | ||
| import domolibrary.routes.cloud_amplifier as cloud_amplifier_routes | ||
| import domolibrary.classes.DomoLineage as dmdl | ||
| import domolibrary.utils.DictDot as util_dd | ||
| import domolibrary.utils.chunk_execution as dmce | ||
| import domolibrary.utils.convert as dmut | ||
| import domolibrary.utils.files as dmfi | ||
| from dataclasses import dataclass, field | ||
| from typing import List, Any | ||
| from copy import deepcopy | ||
| import json | ||
| import httpx | ||
| from nbdev.showdoc import patch_to | ||
| # %% ../../nbs/classes/50_DomoIntegration.ipynb 5 | ||
| from dataclasses import dataclass, field | ||
| from typing import List, Dict, Any | ||
| @dataclass | ||
| class CloudAmplifier_PollingSchedule: | ||
| days_of_week: List[int] | ||
| interval: str | ||
| months_of_year: List[int] | ||
| once_a_day: bool | ||
| timezone: str | ||
| type: str | ||
| def to_json(self): | ||
| return { | ||
| "daysOfWeek": self.days_of_week, | ||
| "interval": self.interval, | ||
| "monthsOfYear": self.months_of_year, | ||
| "onceADay": self.once_a_day, | ||
| "timezone": self.timezone, | ||
| "type": self.type | ||
| } | ||
| @classmethod | ||
| def from_dict(cls, d: dict): | ||
| return cls( | ||
| days_of_week=d.get("daysOfWeek", []), | ||
| interval=d.get("interval"), | ||
| months_of_year=d.get("monthsOfYear", []), | ||
| once_a_day=d.get("onceADay"), | ||
| timezone=d.get("timezone"), | ||
| type=d.get("type") | ||
| ) | ||
| @dataclass | ||
| class CloudAmplifier_Warehouse: | ||
| activities: List[str] | ||
| activity: str | ||
| device: str | ||
| device_name: str | ||
| domo_useable: bool | ||
| instance_size: int | ||
| warehouse: str | ||
| warehouse_size_friendly_name: str | ||
| def to_json(self): | ||
| return { | ||
| "activities": self.activities, | ||
| "activity": self.activity, | ||
| "device": self.device, | ||
| "deviceName": self.device_name, | ||
| "domoUseable": self.domo_useable, | ||
| "instanceSize": self.instance_size, | ||
| "warehouse": self.warehouse, | ||
| "warehouseSizeFriendlyName": self.warehouse_size_friendly_name | ||
| } | ||
| @classmethod | ||
| def from_dict(cls, d: dict): | ||
| return cls( | ||
| activities=d.get("activities", []), | ||
| activity=d.get("activity"), | ||
| device=d.get("device"), | ||
| device_name=d.get("deviceName"), | ||
| domo_useable=d.get("domoUseable"), | ||
| instance_size=d.get("instanceSize"), | ||
| warehouse=d.get("warehouse"), | ||
| warehouse_size_friendly_name=d.get("warehouseSizeFriendlyName") | ||
| ) | ||
| @dataclass | ||
| class DomoIntegration_OwnerEntity: | ||
| id: str | ||
| type: Any | ||
| def to_json(self): | ||
| return { | ||
| "id": self.id, | ||
| "type": self.type | ||
| } | ||
| @classmethod | ||
| def from_dict(cls, d: dict): | ||
| return cls( | ||
| id=d.get("id"), | ||
| type=d.get("type") | ||
| ) | ||
| @dataclass | ||
| class DomoIntegration_PropertyConfig: | ||
| config_type: str | ||
| key: str | ||
| value: Any | ||
| def to_json(self): | ||
| return { | ||
| "configType": self.config_type, | ||
| "key": self.key, | ||
| "value": self.value | ||
| } | ||
| @classmethod | ||
| def from_dict(cls, d: dict): | ||
| return cls( | ||
| config_type=d.get("configType"), | ||
| key=d.get("key"), | ||
| value=d.get("value") | ||
| ) | ||
| @dataclass | ||
| class DomoIntegration(DomoEntity): | ||
| id: str | ||
| admin_auth_method: str | ||
| auth_method: str | ||
| description: str | ||
| enable_native_transform: bool | ||
| engine: str | ||
| friendly_name: str | ||
| initialized: bool | ||
| owner_entity: DomoIntegration_OwnerEntity | ||
| polling_rate_min: int | ||
| polling_schedule: CloudAmplifier_PollingSchedule | ||
| properties: Dict[str, DomoIntegration_PropertyConfig] | ||
| service_account_id: str | ||
| ttl_minutes: int | ||
| warehouses: List[CloudAmplifier_Warehouse] | ||
| warehouses_valid_configuration: bool | ||
| writeable: bool | ||
| @classmethod | ||
| async def get_by_id( | ||
| cls, | ||
| auth: dmda.DomoAuth, | ||
| integration_id: str, | ||
| debug_api: bool = False, | ||
| debug_num_stacks_to_drop: int = 2, | ||
| return_raw: bool = False, | ||
| session: httpx.AsyncClient = None, | ||
| ) -> "DomoIntegration": | ||
| res = await cloud_amplifier_routes.get_integration_by_id( | ||
| integration_id=integration_id, | ||
| auth=auth, | ||
| debug_api=debug_api, | ||
| debug_num_stacks_to_drop=debug_num_stacks_to_drop, | ||
| parent_class=cls.__name__, | ||
| session = session | ||
| ) | ||
| if return_raw: | ||
| return res | ||
| return cls.from_dict( res.response) | ||
| @classmethod | ||
| def from_dict(cls, d: dict): | ||
| return cls( | ||
| id=d.get("id"), | ||
| admin_auth_method=d.get("adminAuthMethod"), | ||
| auth_method=d.get("authMethod"), | ||
| description=d.get("description"), | ||
| enable_native_transform=d.get("enableNativeTransform"), | ||
| engine=d.get("engine"), | ||
| friendly_name=d.get("friendlyName"), | ||
| initialized=d.get("initialized"), | ||
| owner_entity=DomoIntegration_OwnerEntity.from_dict(d.get("ownerEntity", {})), | ||
| polling_rate_min=d.get("pollingRateMin"), | ||
| polling_schedule=CloudAmplifier_PollingSchedule.from_dict(d.get("pollingSchedule", {})), | ||
| properties={k: DomoIntegration_PropertyConfig.from_dict(v) for k, v in d.get("properties", {}).items()}, | ||
| service_account_id=d.get("serviceAccountId"), | ||
| ttl_minutes=d.get("ttlMinutes"), | ||
| warehouses=[CloudAmplifier_Warehouse.from_dict(w) for w in d.get("warehouses", [])], | ||
| warehouses_valid_configuration=d.get("warehousesValidConfiguration"), | ||
| writeable=d.get("writeable") | ||
| ) | ||
| def to_json(self): | ||
| return { | ||
| "adminAuthMethod": self.admin_auth_method, | ||
| "authMethod": self.auth_method, | ||
| "description": self.description, | ||
| "enableNativeTransform": self.enable_native_transform, | ||
| "engine": self.engine, | ||
| "friendlyName": self.friendly_name, | ||
| "id": self.id, | ||
| "initialized": self.initialized, | ||
| "ownerEntity": self.owner_entity.to_json() if self.owner_entity else None, | ||
| "pollingRateMin": self.polling_rate_min, | ||
| "pollingSchedule": self.polling_schedule.to_json() if self.polling_schedule else None, | ||
| "properties": {k: v.to_json() for k, v in self.properties.items()} if self.properties else {}, | ||
| "serviceAccountId": self.service_account_id, | ||
| "ttlMinutes": self.ttl_minutes, | ||
| "warehouses": [w.to_json() for w in self.warehouses] if self.warehouses else [], | ||
| "warehousesValidConfiguration": self.warehouses_valid_configuration, | ||
| "writeable": self.writeable | ||
| } |
| # AUTOGENERATED! DO NOT EDIT! File to edit: ../../nbs/routes/cloud_amplifier.ipynb. | ||
| # %% auto 0 | ||
| __all__ = ['ENGINES', 'create_integration_body', 'Cloud_Amplifier_Error', 'get_integrations', 'get_integration_by_id', | ||
| 'get_integration_permissions', 'check_for_colliding_datasources', 'get_federated_source_metadata', | ||
| 'get_integration_warehouses', 'get_databases', 'get_schemas', 'get_tables', | ||
| 'convert_federated_to_cloud_amplifier', 'create_integration', 'update_integration_warehouses', | ||
| 'update_integration', 'delete_integration'] | ||
| # %% ../../nbs/routes/cloud_amplifier.ipynb 3 | ||
| from abc import abstractmethod | ||
| from typing import Optional, Literal, Any | ||
| from pprint import pprint | ||
| import httpx | ||
| import domolibrary.client.get_data as gd | ||
| import domolibrary.client.ResponseGetData as rgd | ||
| import domolibrary.client.DomoAuth as dmda | ||
| import domolibrary.client.DomoError as dmde | ||
| from domolibrary.client.DomoEntity import DomoEnum | ||
| # %% ../../nbs/routes/cloud_amplifier.ipynb 7 | ||
| # TODO: Expand to include all engines | ||
| ENGINES = Literal["SNOWFLAKE", "BIGQUERY"] | ||
| def create_integration_body( | ||
| engine: ENGINES, | ||
| description: str, | ||
| friendly_name: str, | ||
| service_account_id: str, | ||
| auth_method: str, | ||
| admin_auth_method: str, | ||
| ): | ||
| body = { | ||
| "engine": engine, | ||
| "properties": { | ||
| "friendlyName": { | ||
| "key": "friendlyName", | ||
| "configType": "CONFIG", | ||
| "value": friendly_name, | ||
| }, | ||
| "description": { | ||
| "key": "description", | ||
| "configType": "CONFIG", | ||
| "value": description, | ||
| }, | ||
| "serviceAccountId": { | ||
| "key": "serviceAccountId", | ||
| "configType": "CONFIG", | ||
| "value": service_account_id, | ||
| }, | ||
| "AUTH_METHOD": { | ||
| "key": "AUTH_METHOD", | ||
| "configType": "CONFIG", | ||
| "value": auth_method, | ||
| }, | ||
| "ADMIN_AUTH_METHOD": { | ||
| "key": "ADMIN_AUTH_METHOD", | ||
| "configType": "CONFIG", | ||
| "value": admin_auth_method, | ||
| }, | ||
| }, | ||
| } | ||
| return body | ||
| # %% ../../nbs/routes/cloud_amplifier.ipynb 9 | ||
| class Cloud_Amplifier_Error(dmde.RouteError): | ||
| def __init__( | ||
| self, res: rgd.ResponseGetData, account_id: str = "", message: str = "" | ||
| ): | ||
| super().__init__(res=res, message=message, entity_id=account_id) | ||
| # %% ../../nbs/routes/cloud_amplifier.ipynb 11 | ||
| @gd.route_function | ||
| async def get_integrations( | ||
| auth: dmda.DomoAuth, | ||
| integration_engine: Optional[ENGINES] = None, | ||
| debug_api: bool = False, | ||
| debug_num_stacks_to_drop: int = 1, | ||
| parent_class: Optional[str] = None, | ||
| session: Optional[httpx.AsyncClient] = None, | ||
| ): | ||
| """ | ||
| Retrieves a list of all the integrations. | ||
| """ | ||
| api_type = "data" | ||
| filter = "" | ||
| if integration_engine: # Change to query if engine is provided to filter by engine | ||
| api_type = "query" | ||
| filter = f"?filter=deviceEngine%3A{integration_engine}" | ||
| url = f"https://{auth.domo_instance}.domo.com/api/{api_type}/v1/byos/accounts{filter}" | ||
| res = await gd.get_data( | ||
| auth = auth, | ||
| url = url, | ||
| method = "GET", | ||
| debug_api = debug_api, | ||
| num_stacks_to_drop = debug_num_stacks_to_drop, | ||
| parent_class = parent_class, | ||
| session = session, | ||
| ) | ||
| if res and not res.is_success: | ||
| raise Cloud_Amplifier_Error(res=res) | ||
| return res | ||
| @gd.route_function | ||
| async def get_integration_by_id( | ||
| auth: dmda.DomoAuth, | ||
| integration_id: str, | ||
| debug_api: bool = False, | ||
| debug_num_stacks_to_drop: int = 1, | ||
| parent_class: Optional[str] = None, | ||
| session: Optional[httpx.AsyncClient] = None, | ||
| ): | ||
| """ | ||
| Retrieves a list of all the integrations. | ||
| """ | ||
| url = f"https://{auth.domo_instance}.domo.com/api/query/v1/byos/accounts/{integration_id}" | ||
| res = await gd.get_data( | ||
| auth = auth, | ||
| url = url, | ||
| method = "GET", | ||
| debug_api = debug_api, | ||
| num_stacks_to_drop = debug_num_stacks_to_drop, | ||
| parent_class = parent_class, | ||
| session = session, | ||
| ) | ||
| if res and not res.is_success: | ||
| raise Cloud_Amplifier_Error(res=res) | ||
| return res | ||
| @gd.route_function | ||
| async def get_integration_permissions( | ||
| auth: dmda.DomoAuth, | ||
| user_id: str, | ||
| integration_ids: list[str] = [], | ||
| debug_api: bool = False, | ||
| debug_num_stacks_to_drop: int = 1, | ||
| parent_class: Optional[str] = None, | ||
| session: Optional[httpx.AsyncClient] = None, | ||
| ): | ||
| """ | ||
| Retrieves a list of all the integrations. | ||
| """ | ||
| url = f"https://{auth.domo_instance}.domo.com/api/query/v1/byos/accounts/permissions/list" | ||
| body: dict[str, Any] = {"userId": user_id} | ||
| if integration_ids: | ||
| body.update({"integrationIds": integration_ids}) | ||
| res = await gd.get_data( | ||
| auth = auth, | ||
| url = url, | ||
| method = "POST", | ||
| body = body, | ||
| debug_api = debug_api, | ||
| num_stacks_to_drop = debug_num_stacks_to_drop, | ||
| parent_class = parent_class, | ||
| session = session, | ||
| ) | ||
| if res and not res.is_success: | ||
| raise Cloud_Amplifier_Error(res=res) | ||
| return res | ||
| # %% ../../nbs/routes/cloud_amplifier.ipynb 12 | ||
| @gd.route_function | ||
| async def check_for_colliding_datasources( | ||
| auth: dmda.DomoAuth, | ||
| dataset_id: str, | ||
| return_raw: bool = False, | ||
| debug_api: bool = False, | ||
| debug_num_stacks_to_drop: int = 1, | ||
| parent_class: Optional[str] = None, | ||
| session: Optional[httpx.AsyncClient] = None, | ||
| ): | ||
| """ | ||
| Checks for Cloud Amplifier integrations that collide with an existing Domo Dataset. | ||
| """ | ||
| url = f"https://{auth.domo_instance}.domo.com/api/query/migration/integrations/datasource/{dataset_id}" | ||
| res = await gd.get_data( | ||
| auth=auth, | ||
| url=url, | ||
| method="GET", | ||
| debug_api=debug_api, | ||
| num_stacks_to_drop=debug_num_stacks_to_drop, | ||
| parent_class=parent_class, | ||
| session=session, | ||
| ) | ||
| if return_raw: | ||
| return res | ||
| # A 400 may be returned if no federated metadata exists for the dataset | ||
| if res and res.status == 400: | ||
| raise Cloud_Amplifier_Error(res=res, message=f"No federated metadata exists for the datasource {dataset_id}") | ||
| if res and not res.is_success and res.status != 400: | ||
| raise Cloud_Amplifier_Error(res=res) | ||
| return res | ||
| @gd.route_function | ||
| async def get_federated_source_metadata( | ||
| auth: dmda.DomoAuth, | ||
| dataset_id: str, | ||
| debug_api: bool = False, | ||
| debug_num_stacks_to_drop: int = 1, | ||
| parent_class: Optional[str] = None, | ||
| session: Optional[httpx.AsyncClient] = None, | ||
| ): | ||
| """ | ||
| Retrieves federated source metadata for a dataset. | ||
| """ | ||
| url = f"https://{auth.domo_instance}.domo.com/api/federated/v1/config/datasources/{dataset_id}" | ||
| res = await gd.get_data( | ||
| auth=auth, | ||
| url=url, | ||
| method="GET", | ||
| debug_api=debug_api, | ||
| num_stacks_to_drop=debug_num_stacks_to_drop, | ||
| parent_class=parent_class, | ||
| session=session, | ||
| ) | ||
| # A 404 may be returned if no federated metadata exists for the dataset | ||
| if res and res.status == 404: | ||
| raise Cloud_Amplifier_Error(res=res, message=f"Could not find a federated datasource with id: {dataset_id}") | ||
| if res and not res.is_success and res.status != 404: | ||
| raise Cloud_Amplifier_Error(res=res) | ||
| return res | ||
| @gd.route_function | ||
| async def get_integration_warehouses( | ||
| auth: dmda.DomoAuth, | ||
| integration_id: str, | ||
| debug_api: bool = False, | ||
| debug_num_stacks_to_drop: int = 1, | ||
| parent_class: Optional[str] = None, | ||
| session: Optional[httpx.AsyncClient] = None, | ||
| ): | ||
| """ | ||
| Lists available compute warehouses for a Cloud Amplifier integration. User must have permission to view the integration. | ||
| """ | ||
| url = f"https://{auth.domo_instance}.domo.com/api/query/v1/byos/warehouses/{integration_id}" | ||
| res = await gd.get_data( | ||
| auth=auth, | ||
| url=url, | ||
| method="GET", | ||
| debug_api=debug_api, | ||
| num_stacks_to_drop=debug_num_stacks_to_drop, | ||
| parent_class=parent_class, | ||
| session=session, | ||
| ) | ||
| if res and not res.is_success: | ||
| raise Cloud_Amplifier_Error(res=res) | ||
| return res | ||
| # %% ../../nbs/routes/cloud_amplifier.ipynb 13 | ||
| @gd.route_function | ||
| async def get_databases( | ||
| auth: dmda.DomoAuth, | ||
| integration_id: str, | ||
| page: int = 0, | ||
| rows: int = 5000, | ||
| debug_api: bool = False, | ||
| debug_num_stacks_to_drop: int = 1, | ||
| parent_class: Optional[str] = None, | ||
| session: Optional[httpx.AsyncClient] = None, | ||
| ): | ||
| """ | ||
| Retrieves a list of all the databases for a Cloud Amplifier integration. | ||
| """ | ||
| url = f"https://{auth.domo_instance}.domo.com/api/query/v1/byos/accounts/{integration_id}/databases?page={page}&rows={rows}" | ||
| res = await gd.get_data( | ||
| auth=auth, | ||
| url=url, | ||
| method="GET", | ||
| debug_api=debug_api, | ||
| num_stacks_to_drop=debug_num_stacks_to_drop, | ||
| parent_class=parent_class, | ||
| session=session, | ||
| ) | ||
| if res and not res.is_success: | ||
| raise Cloud_Amplifier_Error(res=res) | ||
| return res | ||
| # %% ../../nbs/routes/cloud_amplifier.ipynb 14 | ||
| @gd.route_function | ||
| async def get_schemas( | ||
| auth: dmda.DomoAuth, | ||
| integration_id: str, | ||
| database: str, | ||
| page: int = 0, | ||
| rows: int = 5000, | ||
| debug_api: bool = False, | ||
| debug_num_stacks_to_drop: int = 1, | ||
| parent_class: Optional[str] = None, | ||
| session: Optional[httpx.AsyncClient] = None, | ||
| ): | ||
| """ | ||
| Retrieves a list of all the schemas for a Cloud Amplifier integration. | ||
| """ | ||
| url = f"https://{auth.domo_instance}.domo.com/api/query/v1/byos/accounts/{integration_id}/databases/{database}/schemas?page={page}&rows={rows}" | ||
| res = await gd.get_data( | ||
| auth=auth, | ||
| url=url, | ||
| method="GET", | ||
| debug_api=debug_api, | ||
| num_stacks_to_drop=debug_num_stacks_to_drop, | ||
| parent_class=parent_class, | ||
| session=session, | ||
| ) | ||
| if res and not res.is_success: | ||
| raise Cloud_Amplifier_Error(res=res) | ||
| return res | ||
| @gd.route_function | ||
| async def get_tables( | ||
| auth: dmda.DomoAuth, | ||
| integration_id: str, | ||
| database: str, | ||
| schema: str, | ||
| page: int = 0, | ||
| rows: int = 5000, | ||
| debug_api: bool = False, | ||
| debug_num_stacks_to_drop: int = 1, | ||
| parent_class: Optional[str] = None, | ||
| session: Optional[httpx.AsyncClient] = None, | ||
| ): | ||
| """ | ||
| Retrieves a list of all the tables for a Cloud Amplifier integration. | ||
| """ | ||
| url = f"https://{auth.domo_instance}.domo.com/api/query/v1/byos/accounts/{integration_id}/databases/{database}/schemas/{schema}/objects?page={page}&rows={rows}" | ||
| res = await gd.get_data( | ||
| auth=auth, | ||
| url=url, | ||
| method="GET", | ||
| debug_api=debug_api, | ||
| num_stacks_to_drop=debug_num_stacks_to_drop, | ||
| parent_class=parent_class, | ||
| session=session, | ||
| ) | ||
| if res and not res.is_success: | ||
| raise Cloud_Amplifier_Error(res=res) | ||
| return res | ||
| # %% ../../nbs/routes/cloud_amplifier.ipynb 18 | ||
| @gd.route_function | ||
| async def convert_federated_to_cloud_amplifier( | ||
| auth: dmda.DomoAuth, | ||
| federated_dataset_id: str, | ||
| cloud_amplifier_integration_id: str, | ||
| return_raw: bool = False, | ||
| debug_api: bool = False, | ||
| debug_num_stacks_to_drop: int = 1, | ||
| parent_class: Optional[str] = None, | ||
| session: Optional[httpx.AsyncClient] = None, | ||
| ): | ||
| """ | ||
| Converts a federated dataset to use a Cloud Amplifier integration. | ||
| """ | ||
| url = ( | ||
| f"https://{auth.domo_instance}.domo.com/api/query/migration/federated/to/amplifier/" | ||
| f"{federated_dataset_id}/integrations/{cloud_amplifier_integration_id}" | ||
| ) | ||
| res = await gd.get_data( | ||
| auth=auth, | ||
| url=url, | ||
| method="POST", | ||
| body={}, | ||
| debug_api=debug_api, | ||
| num_stacks_to_drop=debug_num_stacks_to_drop, | ||
| parent_class=parent_class, | ||
| session=session, | ||
| ) | ||
| if return_raw: | ||
| return res | ||
| if res and not res.is_success: | ||
| raise Cloud_Amplifier_Error(res=res) | ||
| return res | ||
| @gd.route_function | ||
| async def create_integration( | ||
| auth: dmda.DomoAuth, | ||
| engine: ENGINES, | ||
| friendly_name: str, | ||
| service_account_id: str, | ||
| auth_method: str, | ||
| description: str = "", | ||
| admin_auth_method: Optional[str] = None, | ||
| debug_api: bool = False, | ||
| debug_num_stacks_to_drop: int = 1, | ||
| parent_class: Optional[str] = None, | ||
| session: Optional[httpx.AsyncClient] = None, | ||
| ): | ||
| """ | ||
| Creates a new Cloud Amplifier integration. | ||
| """ | ||
| if admin_auth_method is None: | ||
| admin_auth_method = auth_method | ||
| body = create_integration_body( | ||
| engine=engine, | ||
| friendly_name=friendly_name, | ||
| service_account_id=service_account_id, | ||
| auth_method=auth_method, | ||
| admin_auth_method=admin_auth_method, | ||
| description=description, | ||
| ) | ||
| url = f"https://{auth.domo_instance}.domo.com/api/query/v1/byos/accounts" | ||
| res = await gd.get_data( | ||
| auth=auth, | ||
| url=url, | ||
| method="POST", | ||
| body=body, | ||
| debug_api=debug_api, | ||
| num_stacks_to_drop=debug_num_stacks_to_drop, | ||
| parent_class=parent_class, | ||
| session=session, | ||
| ) | ||
| if res and not res.is_success: | ||
| raise Cloud_Amplifier_Error(res=res) | ||
| return res | ||
| # %% ../../nbs/routes/cloud_amplifier.ipynb 23 | ||
| @gd.route_function | ||
| async def update_integration_warehouses( | ||
| auth: dmda.DomoAuth, | ||
| integration_id: str, | ||
| warehouses: list[dict[str, Any]], | ||
| debug_api: bool = False, | ||
| debug_num_stacks_to_drop: int = 1, | ||
| parent_class: Optional[str] = None, | ||
| session: Optional[httpx.AsyncClient] = None, | ||
| ): | ||
| """ | ||
| Updates the compute warehouses for a Cloud Amplifier integration. | ||
| Expects a list of warehouse dicts as returned by the GET warehouses endpoint. | ||
| """ | ||
| url = f"https://{auth.domo_instance}.domo.com/api/query/v1/byos/warehouses/{integration_id}" | ||
| res = await gd.get_data( | ||
| auth=auth, | ||
| url=url, | ||
| method="PUT", | ||
| body=warehouses, | ||
| debug_api=debug_api, | ||
| num_stacks_to_drop=debug_num_stacks_to_drop, | ||
| parent_class=parent_class, | ||
| session=session, | ||
| ) | ||
| if res and not res.is_success: | ||
| # Using POST error class for non-GET write operations | ||
| raise Cloud_Amplifier_Error(res=res) | ||
| return res | ||
| @gd.route_function | ||
| async def update_integration( | ||
| auth: dmda.DomoAuth, | ||
| integration_id: str, | ||
| update_body: dict[str, Any], | ||
| return_raw: bool = False, | ||
| debug_api: bool = False, | ||
| debug_num_stacks_to_drop: int = 1, | ||
| parent_class: Optional[str] = None, | ||
| session: Optional[httpx.AsyncClient] = None, | ||
| ): | ||
| """ | ||
| Updates a Cloud Amplifier integration. | ||
| """ | ||
| url = f"https://{auth.domo_instance}.domo.com/api/query/v1/byos/accounts/{integration_id}" | ||
| res = await gd.get_data( | ||
| auth=auth, | ||
| url=url, | ||
| method="PUT", | ||
| body=update_body, | ||
| debug_api=debug_api, | ||
| num_stacks_to_drop=debug_num_stacks_to_drop, | ||
| parent_class=parent_class, | ||
| session=session, | ||
| ) | ||
| if return_raw: | ||
| return res | ||
| if res and not res.is_success: | ||
| raise Cloud_Amplifier_Error(res=res) | ||
| return res | ||
| # %% ../../nbs/routes/cloud_amplifier.ipynb 27 | ||
| @gd.route_function | ||
| async def delete_integration( | ||
| auth: dmda.DomoAuth, | ||
| integration_id: str, | ||
| debug_api: bool = False, | ||
| debug_num_stacks_to_drop: int = 1, | ||
| parent_class: Optional[str] = None, | ||
| session: Optional[httpx.AsyncClient] = None, | ||
| ): | ||
| """ | ||
| Deletes a Cloud Amplifier integration. | ||
| """ | ||
| url = f"https://{auth.domo_instance}.domo.com/api/data/v1/byos/accounts/{integration_id}" | ||
| res = await gd.get_data( | ||
| auth=auth, | ||
| url=url, | ||
| method="DELETE", | ||
| debug_api=debug_api, | ||
| num_stacks_to_drop=debug_num_stacks_to_drop, | ||
| parent_class=parent_class, | ||
| session=session, | ||
| ) | ||
| if res and not res.is_success: | ||
| raise Cloud_Amplifier_Error(res=res) | ||
| return res |
@@ -1,4 +0,4 @@ | ||
| Metadata-Version: 2.2 | ||
| Metadata-Version: 2.4 | ||
| Name: domolibrary | ||
| Version: 4.5.26 | ||
| Version: 4.5.28 | ||
| Home-page: https://github.com/jaewilson07/domo_library | ||
@@ -44,2 +44,3 @@ Author: Jae Wilson | ||
| Dynamic: license | ||
| Dynamic: license-file | ||
| Dynamic: provides-extra | ||
@@ -46,0 +47,0 @@ Dynamic: requires-dist |
@@ -55,2 +55,3 @@ LICENSE | ||
| domolibrary/classes/DomoInstanceConfig_UserAttribute.py | ||
| domolibrary/classes/DomoIntegration.py | ||
| domolibrary/classes/DomoJupyter.py | ||
@@ -94,2 +95,3 @@ domolibrary/classes/DomoJupyter_Account.py | ||
| domolibrary/routes/card.py | ||
| domolibrary/routes/cloud_amplifier.py | ||
| domolibrary/routes/codeengine.py | ||
@@ -96,0 +98,0 @@ domolibrary/routes/codeengine_crud.py |
@@ -1,1 +0,1 @@ | ||
| __version__ = "4.5.26" | ||
| __version__ = "4.5.28" |
@@ -694,3 +694,2 @@ # AUTOGENERATED! DO NOT EDIT! File to edit: ../../nbs/classes/50_DomoInstanceConfig.ipynb. | ||
| self: DomoInstanceConfig, | ||
| is_use_left_nav: bool = True, | ||
| return_raw: bool = False, | ||
@@ -705,3 +704,2 @@ session: httpx.AsyncClient = None, | ||
| auth=self.auth, | ||
| is_use_left_nav=is_use_left_nav, | ||
| session=session, | ||
@@ -708,0 +706,0 @@ debug_api=debug_api, |
@@ -6,3 +6,3 @@ """preferred response class for all API requests""" | ||
| # %% auto 0 | ||
| __all__ = ['NotImplemented', 'DomoEntity', 'DomoEntity_w_Lineage', 'DomoSubEntity', 'Entity_Relation'] | ||
| __all__ = ['NotImplemented', 'DomoBase', 'DomoEntity', 'DomoEntity_w_Lineage', 'DomoSubEntity', 'Entity_Relation'] | ||
@@ -56,3 +56,12 @@ # %% ../../nbs/client/99_DomoEntity.ipynb 2 | ||
| @dataclass | ||
| class DomoEntity(abc.ABC): | ||
| class DomoBase(abc.ABC): | ||
| def to_dict(self, overrides : dict = None): | ||
| raise NotImplementedError("This method should be implemented by subclasses.") | ||
| def _from_json(self, overrides : dict = None): | ||
| raise NotImplementedError("This method should be implemented by subclasses.") | ||
| @dataclass | ||
| class DomoEntity(DomoBase): | ||
| auth: dmda.DomoAuth = field(repr=False) | ||
@@ -59,0 +68,0 @@ raw : dict = field(repr=False) |
+3
-2
@@ -1,4 +0,4 @@ | ||
| Metadata-Version: 2.2 | ||
| Metadata-Version: 2.4 | ||
| Name: domolibrary | ||
| Version: 4.5.26 | ||
| Version: 4.5.28 | ||
| Home-page: https://github.com/jaewilson07/domo_library | ||
@@ -44,2 +44,3 @@ Author: Jae Wilson | ||
| Dynamic: license | ||
| Dynamic: license-file | ||
| Dynamic: provides-extra | ||
@@ -46,0 +47,0 @@ Dynamic: requires-dist |
+1
-2
@@ -8,3 +8,3 @@ [DEFAULT] | ||
| lib_name = domolibrary | ||
| version = 4.5.26 | ||
| version = 4.5.28 | ||
@@ -44,4 +44,3 @@ min_python = 3.9 | ||
| conda_requirements = https://domo-conda-prod.s3.amazonaws.com/domo::domojupyter | ||
| # dev_requirements = | ||
| # console_scripts = |
Sorry, the diff of this file is too big to display
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
1651700
2.21%130
1.56%32613
2.37%