Skip to content

Commit

Permalink
CodeGen from PR 27223 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 3fadaf0674fb04788afbe3264e05a1d01b46393e into c75671ae0a5d82d7d96fda75150478e8581408d8
  • Loading branch information
SDKAuto committed Jan 24, 2024
1 parent 6981ed3 commit 451c032
Show file tree
Hide file tree
Showing 113 changed files with 70,045 additions and 2,087 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"commit": "28b4fa4da766bc9f21d4c3b7c838bd90ddff8c1d",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"typespec_src": "specification/ai/HealthInsights/HealthInsights.OncoPhenotype",
"@azure-tools/typespec-python": "0.18.2"
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@

from azure.core import PipelineClient
from azure.core.credentials import AzureKeyCredential
from azure.core.pipeline import policies
from azure.core.rest import HttpRequest, HttpResponse

from ._configuration import CancerProfilingClientConfiguration
from ._operations import CancerProfilingClientOperationsMixin
from ._serialization import Deserializer, Serializer


class CancerProfilingClient(
CancerProfilingClientOperationsMixin
): # pylint: disable=client-accepts-api-version-keyword
class CancerProfilingClient(CancerProfilingClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword
"""CancerProfilingClient.
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example:
Expand All @@ -29,23 +28,40 @@ class CancerProfilingClient(
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.AzureKeyCredential
:keyword api_version: The API version to use for this operation. Default value is
"2023-03-01-preview". Note that overriding this default value may result in unsupported
"2023-09-01-preview". Note that overriding this default value may result in unsupported
behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
"""

def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any) -> None:
_endpoint = "{endpoint}/healthinsights"
_endpoint = "{endpoint}/health-insights"
self._config = CancerProfilingClientConfiguration(endpoint=endpoint, credential=credential, **kwargs)
self._client: PipelineClient = PipelineClient(base_url=_endpoint, config=self._config, **kwargs)
_policies = kwargs.pop("policies", None)
if _policies is None:
_policies = [
policies.RequestIdPolicy(**kwargs),
self._config.headers_policy,
self._config.user_agent_policy,
self._config.proxy_policy,
policies.ContentDecodePolicy(**kwargs),
self._config.redirect_policy,
self._config.retry_policy,
self._config.authentication_policy,
self._config.custom_hook_policy,
self._config.logging_policy,
policies.DistributedTracingPolicy(**kwargs),
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
self._config.http_logging_policy,
]
self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs)

self._serialize = Serializer()
self._deserialize = Deserializer()
self._serialize.client_side_validation = False

def send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
Expand All @@ -69,7 +85,7 @@ def send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
}

request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
return self._client.send_request(request_copy, **kwargs)
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore

def close(self) -> None:
self._client.close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,15 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

import sys
from typing import Any

from azure.core.configuration import Configuration
from azure.core.credentials import AzureKeyCredential
from azure.core.pipeline import policies

from ._version import VERSION

if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports


class CancerProfilingClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
class CancerProfilingClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for CancerProfilingClient.
Note that all parameters used to create this instance are saved as instance
Expand All @@ -33,14 +26,13 @@ class CancerProfilingClientConfiguration(Configuration): # pylint: disable=too-
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.AzureKeyCredential
:keyword api_version: The API version to use for this operation. Default value is
"2023-03-01-preview". Note that overriding this default value may result in unsupported
"2023-09-01-preview". Note that overriding this default value may result in unsupported
behavior.
:paramtype api_version: str
"""

def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any) -> None:
super(CancerProfilingClientConfiguration, self).__init__(**kwargs)
api_version: Literal["2023-03-01-preview"] = kwargs.pop("api_version", "2023-03-01-preview")
api_version: str = kwargs.pop("api_version", "2023-09-01-preview")

if endpoint is None:
raise ValueError("Parameter 'endpoint' must not be None.")
Expand All @@ -51,6 +43,7 @@ def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any)
self.credential = credential
self.api_version = api_version
kwargs.setdefault("sdk_moniker", "healthinsights-cancerprofiling/{}".format(VERSION))
self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)

def _configure(self, **kwargs: Any) -> None:
Expand All @@ -59,9 +52,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.AzureKeyCredentialPolicy(
Expand Down
Loading

0 comments on commit 451c032

Please sign in to comment.