|
| 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, Optional, TYPE_CHECKING |
| 11 | + |
| 12 | +from azure.core.rest import HttpRequest, HttpResponse |
| 13 | +from azure.mgmt.core import ARMPipelineClient |
| 14 | +from msrest import Deserializer, Serializer |
| 15 | + |
| 16 | +from . import models |
| 17 | +from ._configuration import DNCConfiguration |
| 18 | +from .operations import ControllerOperations, DelegatedNetworkOperations, DelegatedSubnetServiceOperations, Operations, OrchestratorInstanceServiceOperations |
| 19 | + |
| 20 | +if TYPE_CHECKING: |
| 21 | + # pylint: disable=unused-import,ungrouped-imports |
| 22 | + from azure.core.credentials import TokenCredential |
| 23 | + |
| 24 | +class DNC: |
| 25 | + """DNC web api provides way to create, get and delete dnc controller. |
| 26 | +
|
| 27 | + :ivar controller: ControllerOperations operations |
| 28 | + :vartype controller: azure.mgmt.dnc.operations.ControllerOperations |
| 29 | + :ivar delegated_network: DelegatedNetworkOperations operations |
| 30 | + :vartype delegated_network: azure.mgmt.dnc.operations.DelegatedNetworkOperations |
| 31 | + :ivar orchestrator_instance_service: OrchestratorInstanceServiceOperations operations |
| 32 | + :vartype orchestrator_instance_service: |
| 33 | + azure.mgmt.dnc.operations.OrchestratorInstanceServiceOperations |
| 34 | + :ivar delegated_subnet_service: DelegatedSubnetServiceOperations operations |
| 35 | + :vartype delegated_subnet_service: azure.mgmt.dnc.operations.DelegatedSubnetServiceOperations |
| 36 | + :ivar operations: Operations operations |
| 37 | + :vartype operations: azure.mgmt.dnc.operations.Operations |
| 38 | + :param credential: Credential needed for the client to connect to Azure. |
| 39 | + :type credential: ~azure.core.credentials.TokenCredential |
| 40 | + :param subscription_id: The ID of the target subscription. |
| 41 | + :type subscription_id: str |
| 42 | + :param base_url: Service URL. Default value is 'https://management.azure.com'. |
| 43 | + :type base_url: str |
| 44 | + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no |
| 45 | + Retry-After header is present. |
| 46 | + """ |
| 47 | + |
| 48 | + def __init__( |
| 49 | + self, |
| 50 | + credential: "TokenCredential", |
| 51 | + subscription_id: str, |
| 52 | + base_url: str = "https://management.azure.com", |
| 53 | + **kwargs: Any |
| 54 | + ) -> None: |
| 55 | + self._config = DNCConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) |
| 56 | + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) |
| 57 | + |
| 58 | + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} |
| 59 | + self._serialize = Serializer(client_models) |
| 60 | + self._deserialize = Deserializer(client_models) |
| 61 | + self._serialize.client_side_validation = False |
| 62 | + self.controller = ControllerOperations(self._client, self._config, self._serialize, self._deserialize) |
| 63 | + self.delegated_network = DelegatedNetworkOperations(self._client, self._config, self._serialize, self._deserialize) |
| 64 | + self.orchestrator_instance_service = OrchestratorInstanceServiceOperations(self._client, self._config, self._serialize, self._deserialize) |
| 65 | + self.delegated_subnet_service = DelegatedSubnetServiceOperations(self._client, self._config, self._serialize, self._deserialize) |
| 66 | + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) |
| 67 | + |
| 68 | + |
| 69 | + def _send_request( |
| 70 | + self, |
| 71 | + request, # type: HttpRequest |
| 72 | + **kwargs: Any |
| 73 | + ) -> HttpResponse: |
| 74 | + """Runs the network request through the client's chained policies. |
| 75 | +
|
| 76 | + >>> from azure.core.rest import HttpRequest |
| 77 | + >>> request = HttpRequest("GET", "https://www.example.org/") |
| 78 | + <HttpRequest [GET], url: 'https://www.example.org/'> |
| 79 | + >>> response = client._send_request(request) |
| 80 | + <HttpResponse: 200 OK> |
| 81 | +
|
| 82 | + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart |
| 83 | +
|
| 84 | + :param request: The network request you want to make. Required. |
| 85 | + :type request: ~azure.core.rest.HttpRequest |
| 86 | + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. |
| 87 | + :return: The response of your network call. Does not do error handling on your response. |
| 88 | + :rtype: ~azure.core.rest.HttpResponse |
| 89 | + """ |
| 90 | + |
| 91 | + request_copy = deepcopy(request) |
| 92 | + request_copy.url = self._client.format_url(request_copy.url) |
| 93 | + return self._client.send_request(request_copy, **kwargs) |
| 94 | + |
| 95 | + def close(self): |
| 96 | + # type: () -> None |
| 97 | + self._client.close() |
| 98 | + |
| 99 | + def __enter__(self): |
| 100 | + # type: () -> DNC |
| 101 | + self._client.__enter__() |
| 102 | + return self |
| 103 | + |
| 104 | + def __exit__(self, *exc_details): |
| 105 | + # type: (Any) -> None |
| 106 | + self._client.__exit__(*exc_details) |
0 commit comments