|
| 1 | +# coding=utf-8 |
| 2 | +# -------------------------------------------------------------------------- |
| 3 | +# Copyright (c) Microsoft Corporation. All rights reserved. |
| 4 | +# Licensed under the MIT License. See License.txt in the project root for license information. |
| 5 | +# Code generated by Microsoft (R) AutoRest Code Generator. |
| 6 | +# Changes may cause incorrect behavior and will be lost if the code is regenerated. |
| 7 | +# -------------------------------------------------------------------------- |
| 8 | + |
| 9 | +from copy import deepcopy |
| 10 | +from typing import Any, TYPE_CHECKING |
| 11 | + |
| 12 | +from msrest import Deserializer, Serializer |
| 13 | + |
| 14 | +from azure.core.rest import HttpRequest, HttpResponse |
| 15 | +from azure.mgmt.core import ARMPipelineClient |
| 16 | + |
| 17 | +from . import models |
| 18 | +from ._configuration import DevCenterClientConfiguration |
| 19 | +from .operations import AttachedNetworksOperations, CatalogsOperations, DevBoxDefinitionsOperations, DevCentersOperations, EnvironmentTypesOperations, GalleriesOperations, ImageVersionsOperations, ImagesOperations, NetworkConnectionsOperations, OperationStatusesOperations, Operations, PoolsOperations, ProjectEnvironmentTypesOperations, ProjectsOperations, SchedulesOperations, SkusOperations, UsagesOperations |
| 20 | + |
| 21 | +if TYPE_CHECKING: |
| 22 | + # pylint: disable=unused-import,ungrouped-imports |
| 23 | + from azure.core.credentials import TokenCredential |
| 24 | + |
| 25 | +class DevCenterClient: # pylint: disable=too-many-instance-attributes |
| 26 | + """DevCenter Management API. |
| 27 | +
|
| 28 | + :ivar dev_centers: DevCentersOperations operations |
| 29 | + :vartype dev_centers: azure.mgmt.devcenter.operations.DevCentersOperations |
| 30 | + :ivar projects: ProjectsOperations operations |
| 31 | + :vartype projects: azure.mgmt.devcenter.operations.ProjectsOperations |
| 32 | + :ivar attached_networks: AttachedNetworksOperations operations |
| 33 | + :vartype attached_networks: azure.mgmt.devcenter.operations.AttachedNetworksOperations |
| 34 | + :ivar galleries: GalleriesOperations operations |
| 35 | + :vartype galleries: azure.mgmt.devcenter.operations.GalleriesOperations |
| 36 | + :ivar images: ImagesOperations operations |
| 37 | + :vartype images: azure.mgmt.devcenter.operations.ImagesOperations |
| 38 | + :ivar image_versions: ImageVersionsOperations operations |
| 39 | + :vartype image_versions: azure.mgmt.devcenter.operations.ImageVersionsOperations |
| 40 | + :ivar catalogs: CatalogsOperations operations |
| 41 | + :vartype catalogs: azure.mgmt.devcenter.operations.CatalogsOperations |
| 42 | + :ivar environment_types: EnvironmentTypesOperations operations |
| 43 | + :vartype environment_types: azure.mgmt.devcenter.operations.EnvironmentTypesOperations |
| 44 | + :ivar project_environment_types: ProjectEnvironmentTypesOperations operations |
| 45 | + :vartype project_environment_types: |
| 46 | + azure.mgmt.devcenter.operations.ProjectEnvironmentTypesOperations |
| 47 | + :ivar dev_box_definitions: DevBoxDefinitionsOperations operations |
| 48 | + :vartype dev_box_definitions: azure.mgmt.devcenter.operations.DevBoxDefinitionsOperations |
| 49 | + :ivar operations: Operations operations |
| 50 | + :vartype operations: azure.mgmt.devcenter.operations.Operations |
| 51 | + :ivar operation_statuses: OperationStatusesOperations operations |
| 52 | + :vartype operation_statuses: azure.mgmt.devcenter.operations.OperationStatusesOperations |
| 53 | + :ivar usages: UsagesOperations operations |
| 54 | + :vartype usages: azure.mgmt.devcenter.operations.UsagesOperations |
| 55 | + :ivar skus: SkusOperations operations |
| 56 | + :vartype skus: azure.mgmt.devcenter.operations.SkusOperations |
| 57 | + :ivar pools: PoolsOperations operations |
| 58 | + :vartype pools: azure.mgmt.devcenter.operations.PoolsOperations |
| 59 | + :ivar schedules: SchedulesOperations operations |
| 60 | + :vartype schedules: azure.mgmt.devcenter.operations.SchedulesOperations |
| 61 | + :ivar network_connections: NetworkConnectionsOperations operations |
| 62 | + :vartype network_connections: azure.mgmt.devcenter.operations.NetworkConnectionsOperations |
| 63 | + :param credential: Credential needed for the client to connect to Azure. |
| 64 | + :type credential: ~azure.core.credentials.TokenCredential |
| 65 | + :param subscription_id: Unique identifier of the Azure subscription. This is a GUID-formatted |
| 66 | + string (e.g. 00000000-0000-0000-0000-000000000000). |
| 67 | + :type subscription_id: str |
| 68 | + :param base_url: Service URL. Default value is "https://management.azure.com". |
| 69 | + :type base_url: str |
| 70 | + :keyword api_version: Api Version. Default value is "2022-08-01-preview". Note that overriding |
| 71 | + this default value may result in unsupported behavior. |
| 72 | + :paramtype api_version: str |
| 73 | + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no |
| 74 | + Retry-After header is present. |
| 75 | + """ |
| 76 | + |
| 77 | + def __init__( |
| 78 | + self, |
| 79 | + credential: "TokenCredential", |
| 80 | + subscription_id: str, |
| 81 | + base_url: str = "https://management.azure.com", |
| 82 | + **kwargs: Any |
| 83 | + ) -> None: |
| 84 | + self._config = DevCenterClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) |
| 85 | + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) |
| 86 | + |
| 87 | + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} |
| 88 | + self._serialize = Serializer(client_models) |
| 89 | + self._deserialize = Deserializer(client_models) |
| 90 | + self._serialize.client_side_validation = False |
| 91 | + self.dev_centers = DevCentersOperations( |
| 92 | + self._client, self._config, self._serialize, self._deserialize |
| 93 | + ) |
| 94 | + self.projects = ProjectsOperations( |
| 95 | + self._client, self._config, self._serialize, self._deserialize |
| 96 | + ) |
| 97 | + self.attached_networks = AttachedNetworksOperations( |
| 98 | + self._client, self._config, self._serialize, self._deserialize |
| 99 | + ) |
| 100 | + self.galleries = GalleriesOperations( |
| 101 | + self._client, self._config, self._serialize, self._deserialize |
| 102 | + ) |
| 103 | + self.images = ImagesOperations( |
| 104 | + self._client, self._config, self._serialize, self._deserialize |
| 105 | + ) |
| 106 | + self.image_versions = ImageVersionsOperations( |
| 107 | + self._client, self._config, self._serialize, self._deserialize |
| 108 | + ) |
| 109 | + self.catalogs = CatalogsOperations( |
| 110 | + self._client, self._config, self._serialize, self._deserialize |
| 111 | + ) |
| 112 | + self.environment_types = EnvironmentTypesOperations( |
| 113 | + self._client, self._config, self._serialize, self._deserialize |
| 114 | + ) |
| 115 | + self.project_environment_types = ProjectEnvironmentTypesOperations( |
| 116 | + self._client, self._config, self._serialize, self._deserialize |
| 117 | + ) |
| 118 | + self.dev_box_definitions = DevBoxDefinitionsOperations( |
| 119 | + self._client, self._config, self._serialize, self._deserialize |
| 120 | + ) |
| 121 | + self.operations = Operations( |
| 122 | + self._client, self._config, self._serialize, self._deserialize |
| 123 | + ) |
| 124 | + self.operation_statuses = OperationStatusesOperations( |
| 125 | + self._client, self._config, self._serialize, self._deserialize |
| 126 | + ) |
| 127 | + self.usages = UsagesOperations( |
| 128 | + self._client, self._config, self._serialize, self._deserialize |
| 129 | + ) |
| 130 | + self.skus = SkusOperations( |
| 131 | + self._client, self._config, self._serialize, self._deserialize |
| 132 | + ) |
| 133 | + self.pools = PoolsOperations( |
| 134 | + self._client, self._config, self._serialize, self._deserialize |
| 135 | + ) |
| 136 | + self.schedules = SchedulesOperations( |
| 137 | + self._client, self._config, self._serialize, self._deserialize |
| 138 | + ) |
| 139 | + self.network_connections = NetworkConnectionsOperations( |
| 140 | + self._client, self._config, self._serialize, self._deserialize |
| 141 | + ) |
| 142 | + |
| 143 | + |
| 144 | + def _send_request( |
| 145 | + self, |
| 146 | + request: HttpRequest, |
| 147 | + **kwargs: Any |
| 148 | + ) -> HttpResponse: |
| 149 | + """Runs the network request through the client's chained policies. |
| 150 | +
|
| 151 | + >>> from azure.core.rest import HttpRequest |
| 152 | + >>> request = HttpRequest("GET", "https://www.example.org/") |
| 153 | + <HttpRequest [GET], url: 'https://www.example.org/'> |
| 154 | + >>> response = client._send_request(request) |
| 155 | + <HttpResponse: 200 OK> |
| 156 | +
|
| 157 | + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart |
| 158 | +
|
| 159 | + :param request: The network request you want to make. Required. |
| 160 | + :type request: ~azure.core.rest.HttpRequest |
| 161 | + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. |
| 162 | + :return: The response of your network call. Does not do error handling on your response. |
| 163 | + :rtype: ~azure.core.rest.HttpResponse |
| 164 | + """ |
| 165 | + |
| 166 | + request_copy = deepcopy(request) |
| 167 | + request_copy.url = self._client.format_url(request_copy.url) |
| 168 | + return self._client.send_request(request_copy, **kwargs) |
| 169 | + |
| 170 | + def close(self): |
| 171 | + # type: () -> None |
| 172 | + self._client.close() |
| 173 | + |
| 174 | + def __enter__(self): |
| 175 | + # type: () -> DevCenterClient |
| 176 | + self._client.__enter__() |
| 177 | + return self |
| 178 | + |
| 179 | + def __exit__(self, *exc_details): |
| 180 | + # type: (Any) -> None |
| 181 | + self._client.__exit__(*exc_details) |
0 commit comments