|
| 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) Python 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 | +from typing_extensions import Self |
| 12 | + |
| 13 | +from azure.core.pipeline import policies |
| 14 | +from azure.core.rest import HttpRequest, HttpResponse |
| 15 | +from azure.mgmt.core import ARMPipelineClient |
| 16 | +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy |
| 17 | + |
| 18 | +from ._configuration import PineconeVectorDbMgmtClientConfiguration |
| 19 | +from ._serialization import Deserializer, Serializer |
| 20 | +from .operations import Operations, OrganizationsOperations |
| 21 | + |
| 22 | +if TYPE_CHECKING: |
| 23 | + from azure.core.credentials import TokenCredential |
| 24 | + |
| 25 | + |
| 26 | +class PineconeVectorDbMgmtClient: |
| 27 | + """PineconeVectorDbMgmtClient. |
| 28 | +
|
| 29 | + :ivar operations: Operations operations |
| 30 | + :vartype operations: azure.mgmt.pineconevectordb.operations.Operations |
| 31 | + :ivar organizations: OrganizationsOperations operations |
| 32 | + :vartype organizations: azure.mgmt.pineconevectordb.operations.OrganizationsOperations |
| 33 | + :param credential: Credential used to authenticate requests to the service. Required. |
| 34 | + :type credential: ~azure.core.credentials.TokenCredential |
| 35 | + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. |
| 36 | + :type subscription_id: str |
| 37 | + :param base_url: Service host. Default value is "https://management.azure.com". |
| 38 | + :type base_url: str |
| 39 | + :keyword api_version: The API version to use for this operation. Default value is |
| 40 | + "2024-10-22-preview". Note that overriding this default value may result in unsupported |
| 41 | + behavior. |
| 42 | + :paramtype api_version: str |
| 43 | + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no |
| 44 | + Retry-After header is present. |
| 45 | + """ |
| 46 | + |
| 47 | + def __init__( |
| 48 | + self, |
| 49 | + credential: "TokenCredential", |
| 50 | + subscription_id: str, |
| 51 | + base_url: str = "https://management.azure.com", |
| 52 | + **kwargs: Any |
| 53 | + ) -> None: |
| 54 | + _endpoint = "{endpoint}" |
| 55 | + self._config = PineconeVectorDbMgmtClientConfiguration( |
| 56 | + credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs |
| 57 | + ) |
| 58 | + _policies = kwargs.pop("policies", None) |
| 59 | + if _policies is None: |
| 60 | + _policies = [ |
| 61 | + policies.RequestIdPolicy(**kwargs), |
| 62 | + self._config.headers_policy, |
| 63 | + self._config.user_agent_policy, |
| 64 | + self._config.proxy_policy, |
| 65 | + policies.ContentDecodePolicy(**kwargs), |
| 66 | + ARMAutoResourceProviderRegistrationPolicy(), |
| 67 | + self._config.redirect_policy, |
| 68 | + self._config.retry_policy, |
| 69 | + self._config.authentication_policy, |
| 70 | + self._config.custom_hook_policy, |
| 71 | + self._config.logging_policy, |
| 72 | + policies.DistributedTracingPolicy(**kwargs), |
| 73 | + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, |
| 74 | + self._config.http_logging_policy, |
| 75 | + ] |
| 76 | + self._client: ARMPipelineClient = ARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) |
| 77 | + |
| 78 | + self._serialize = Serializer() |
| 79 | + self._deserialize = Deserializer() |
| 80 | + self._serialize.client_side_validation = False |
| 81 | + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) |
| 82 | + self.organizations = OrganizationsOperations(self._client, self._config, self._serialize, self._deserialize) |
| 83 | + |
| 84 | + def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: |
| 85 | + """Runs the network request through the client's chained policies. |
| 86 | +
|
| 87 | + >>> from azure.core.rest import HttpRequest |
| 88 | + >>> request = HttpRequest("GET", "https://www.example.org/") |
| 89 | + <HttpRequest [GET], url: 'https://www.example.org/'> |
| 90 | + >>> response = client.send_request(request) |
| 91 | + <HttpResponse: 200 OK> |
| 92 | +
|
| 93 | + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request |
| 94 | +
|
| 95 | + :param request: The network request you want to make. Required. |
| 96 | + :type request: ~azure.core.rest.HttpRequest |
| 97 | + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. |
| 98 | + :return: The response of your network call. Does not do error handling on your response. |
| 99 | + :rtype: ~azure.core.rest.HttpResponse |
| 100 | + """ |
| 101 | + |
| 102 | + request_copy = deepcopy(request) |
| 103 | + path_format_arguments = { |
| 104 | + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), |
| 105 | + } |
| 106 | + |
| 107 | + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) |
| 108 | + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore |
| 109 | + |
| 110 | + def close(self) -> None: |
| 111 | + self._client.close() |
| 112 | + |
| 113 | + def __enter__(self) -> Self: |
| 114 | + self._client.__enter__() |
| 115 | + return self |
| 116 | + |
| 117 | + def __exit__(self, *exc_details: Any) -> None: |
| 118 | + self._client.__exit__(*exc_details) |
0 commit comments