|
| 1 | +from typing import Optional |
| 2 | + |
| 3 | +from typing import Dict |
| 4 | + |
| 5 | +from box_sdk_gen.internal.utils import to_string |
| 6 | + |
| 7 | +from box_sdk_gen.serialization.json import deserialize |
| 8 | + |
| 9 | +from box_sdk_gen.networking.fetch_options import ResponseFormat |
| 10 | + |
| 11 | +from box_sdk_gen.schemas.v2025_r0.enterprise_configuration_v2025_r0 import ( |
| 12 | + EnterpriseConfigurationV2025R0, |
| 13 | +) |
| 14 | + |
| 15 | +from box_sdk_gen.schemas.v2025_r0.client_error_v2025_r0 import ClientErrorV2025R0 |
| 16 | + |
| 17 | +from box_sdk_gen.parameters.v2025_r0.box_version_header_v2025_r0 import ( |
| 18 | + BoxVersionHeaderV2025R0, |
| 19 | +) |
| 20 | + |
| 21 | +from box_sdk_gen.box.errors import BoxSDKError |
| 22 | + |
| 23 | +from box_sdk_gen.networking.auth import Authentication |
| 24 | + |
| 25 | +from box_sdk_gen.networking.network import NetworkSession |
| 26 | + |
| 27 | +from box_sdk_gen.networking.fetch_options import FetchOptions |
| 28 | + |
| 29 | +from box_sdk_gen.networking.fetch_response import FetchResponse |
| 30 | + |
| 31 | +from box_sdk_gen.internal.utils import prepare_params |
| 32 | + |
| 33 | +from box_sdk_gen.internal.utils import to_string |
| 34 | + |
| 35 | +from box_sdk_gen.internal.utils import ByteStream |
| 36 | + |
| 37 | +from box_sdk_gen.serialization.json import sd_to_json |
| 38 | + |
| 39 | +from box_sdk_gen.serialization.json import SerializedData |
| 40 | + |
| 41 | + |
| 42 | +class EnterpriseConfigurationsManager: |
| 43 | + def __init__( |
| 44 | + self, |
| 45 | + *, |
| 46 | + auth: Optional[Authentication] = None, |
| 47 | + network_session: NetworkSession = None |
| 48 | + ): |
| 49 | + if network_session is None: |
| 50 | + network_session = NetworkSession() |
| 51 | + self.auth = auth |
| 52 | + self.network_session = network_session |
| 53 | + |
| 54 | + def get_enterprise_configuration_by_id_v2025_r0( |
| 55 | + self, |
| 56 | + enterprise_id: str, |
| 57 | + categories: str, |
| 58 | + *, |
| 59 | + box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0, |
| 60 | + extra_headers: Optional[Dict[str, Optional[str]]] = None |
| 61 | + ) -> EnterpriseConfigurationV2025R0: |
| 62 | + """ |
| 63 | + Retrieves the configuration for an enterprise. |
| 64 | + :param enterprise_id: The ID of the enterprise. |
| 65 | + Example: "3442311" |
| 66 | + :type enterprise_id: str |
| 67 | + :param categories: The comma-delimited list of the enterprise configuration categories. |
| 68 | + Allowed values: `security`, `content_and_sharing`, `user_settings`, `shield`. |
| 69 | + :type categories: str |
| 70 | + :param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0 |
| 71 | + :type box_version: BoxVersionHeaderV2025R0, optional |
| 72 | + :param extra_headers: Extra headers that will be included in the HTTP request., defaults to None |
| 73 | + :type extra_headers: Optional[Dict[str, Optional[str]]], optional |
| 74 | + """ |
| 75 | + if extra_headers is None: |
| 76 | + extra_headers = {} |
| 77 | + query_params_map: Dict[str, str] = prepare_params( |
| 78 | + {'categories': to_string(categories)} |
| 79 | + ) |
| 80 | + headers_map: Dict[str, str] = prepare_params( |
| 81 | + {'box-version': to_string(box_version), **extra_headers} |
| 82 | + ) |
| 83 | + response: FetchResponse = self.network_session.network_client.fetch( |
| 84 | + FetchOptions( |
| 85 | + url=''.join( |
| 86 | + [ |
| 87 | + self.network_session.base_urls.base_url, |
| 88 | + '/2.0/enterprise_configurations/', |
| 89 | + to_string(enterprise_id), |
| 90 | + ] |
| 91 | + ), |
| 92 | + method='GET', |
| 93 | + params=query_params_map, |
| 94 | + headers=headers_map, |
| 95 | + response_format=ResponseFormat.JSON, |
| 96 | + auth=self.auth, |
| 97 | + network_session=self.network_session, |
| 98 | + ) |
| 99 | + ) |
| 100 | + return deserialize(response.data, EnterpriseConfigurationV2025R0) |
0 commit comments