Skip to content

Commit 14fd51e

Browse files
author
SDKAuto
committed
CodeGen from PR 34508 in Azure/azure-rest-api-specs
Merge 1a7056622a25f9802a9007200b9e8790376ebdba into f9582b6167e2c81decc4d6b54950afe585e2e610
1 parent 3441543 commit 14fd51e

File tree

86 files changed

+5150
-14841
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+5150
-14841
lines changed

sdk/communication/azure-communication-jobrouter/MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ include azure/communication/jobrouter/py.typed
44
recursive-include tests *.py
55
recursive-include samples *.py *.md
66
include azure/__init__.py
7-
include azure/communication/__init__.py
7+
include azure/communication/__init__.py
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"commit": "726419b7eba57b9b5888ca11e055c8f82dcaae58",
3+
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4+
"typespec_src": "specification/communication/Communication.JobRouter",
5+
"@azure-tools/typespec-python": "0.44.2"
6+
}

sdk/communication/azure-communication-jobrouter/apiview-properties.json

Lines changed: 142 additions & 0 deletions
Large diffs are not rendered by default.

sdk/communication/azure-communication-jobrouter/azure/communication/jobrouter/__init__.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,22 @@
55
# Code generated by Microsoft (R) Python Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
8+
# pylint: disable=wrong-import-position
89

9-
from ._patch import JobRouterAdministrationClient
10-
from ._patch import JobRouterClient
10+
from typing import TYPE_CHECKING
11+
12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
14+
15+
from ._client import JobRouterAdministrationClient # type: ignore
16+
from ._client import JobRouterClient # type: ignore
1117
from ._version import VERSION
1218

1319
__version__ = VERSION
1420

1521
try:
1622
from ._patch import __all__ as _patch_all
17-
from ._patch import * # pylint: disable=unused-wildcard-import
23+
from ._patch import *
1824
except ImportError:
1925
_patch_all = []
2026
from ._patch import patch_sdk as _patch_sdk
@@ -23,6 +29,6 @@
2329
"JobRouterAdministrationClient",
2430
"JobRouterClient",
2531
]
26-
__all__.extend([p for p in _patch_all if p not in __all__])
32+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
2733

2834
_patch_sdk()

sdk/communication/azure-communication-jobrouter/azure/communication/jobrouter/_api_versions.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

sdk/communication/azure-communication-jobrouter/azure/communication/jobrouter/_client.py

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,38 @@
77
# --------------------------------------------------------------------------
88

99
from copy import deepcopy
10-
from typing import Any
10+
from typing import Any, TYPE_CHECKING
11+
from typing_extensions import Self
1112

1213
from azure.core import PipelineClient
1314
from azure.core.pipeline import policies
1415
from azure.core.rest import HttpRequest, HttpResponse
1516

1617
from ._configuration import JobRouterAdministrationClientConfiguration, JobRouterClientConfiguration
1718
from ._operations import JobRouterAdministrationClientOperationsMixin, JobRouterClientOperationsMixin
18-
from ._serialization import Deserializer, Serializer
19+
from ._utils.serialization import Deserializer, Serializer
1920

21+
if TYPE_CHECKING:
22+
from azure.core.credentials import TokenCredential
2023

21-
class JobRouterAdministrationClient(
22-
JobRouterAdministrationClientOperationsMixin
23-
): # pylint: disable=client-accepts-api-version-keyword
24+
25+
class JobRouterAdministrationClient(JobRouterAdministrationClientOperationsMixin):
2426
"""JobRouterAdministrationClient.
2527
2628
:param endpoint: Uri of your Communication resource. Required.
2729
:type endpoint: str
30+
:param credential: Credential used to authenticate requests to the service. Required.
31+
:type credential: ~azure.core.credentials.TokenCredential
2832
:keyword api_version: The API version to use for this operation. Default value is
2933
"2024-01-18-preview". Note that overriding this default value may result in unsupported
3034
behavior.
3135
:paramtype api_version: str
3236
"""
3337

34-
def __init__( # pylint: disable=missing-client-constructor-parameter-credential
35-
self, endpoint: str, **kwargs: Any
36-
) -> None:
38+
def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None:
3739
_endpoint = "{endpoint}"
38-
self._config = JobRouterAdministrationClientConfiguration(endpoint=endpoint, **kwargs)
40+
self._config = JobRouterAdministrationClientConfiguration(endpoint=endpoint, credential=credential, **kwargs)
41+
3942
_policies = kwargs.pop("policies", None)
4043
if _policies is None:
4144
_policies = [
@@ -79,7 +82,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
7982

8083
request_copy = deepcopy(request)
8184
path_format_arguments = {
82-
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True),
85+
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"),
8386
}
8487

8588
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
@@ -88,30 +91,31 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
8891
def close(self) -> None:
8992
self._client.close()
9093

91-
def __enter__(self) -> "JobRouterAdministrationClient":
94+
def __enter__(self) -> Self:
9295
self._client.__enter__()
9396
return self
9497

9598
def __exit__(self, *exc_details: Any) -> None:
9699
self._client.__exit__(*exc_details)
97100

98101

99-
class JobRouterClient(JobRouterClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword
102+
class JobRouterClient(JobRouterClientOperationsMixin):
100103
"""JobRouterClient.
101104
102105
:param endpoint: Uri of your Communication resource. Required.
103106
:type endpoint: str
107+
:param credential: Credential used to authenticate requests to the service. Required.
108+
:type credential: ~azure.core.credentials.TokenCredential
104109
:keyword api_version: The API version to use for this operation. Default value is
105110
"2024-01-18-preview". Note that overriding this default value may result in unsupported
106111
behavior.
107112
:paramtype api_version: str
108113
"""
109114

110-
def __init__( # pylint: disable=missing-client-constructor-parameter-credential
111-
self, endpoint: str, **kwargs: Any
112-
) -> None:
115+
def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None:
113116
_endpoint = "{endpoint}"
114-
self._config = JobRouterClientConfiguration(endpoint=endpoint, **kwargs)
117+
self._config = JobRouterClientConfiguration(endpoint=endpoint, credential=credential, **kwargs)
118+
115119
_policies = kwargs.pop("policies", None)
116120
if _policies is None:
117121
_policies = [
@@ -155,7 +159,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
155159

156160
request_copy = deepcopy(request)
157161
path_format_arguments = {
158-
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True),
162+
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"),
159163
}
160164

161165
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
@@ -164,7 +168,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
164168
def close(self) -> None:
165169
self._client.close()
166170

167-
def __enter__(self) -> "JobRouterClient":
171+
def __enter__(self) -> Self:
168172
self._client.__enter__()
169173
return self
170174

sdk/communication/azure-communication-jobrouter/azure/communication/jobrouter/_configuration.py

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
from typing import Any
9+
from typing import Any, TYPE_CHECKING
1010

1111
from azure.core.pipeline import policies
1212

1313
from ._version import VERSION
1414

15+
if TYPE_CHECKING:
16+
from azure.core.credentials import TokenCredential
17+
1518

1619
class JobRouterAdministrationClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
1720
"""Configuration for JobRouterAdministrationClient.
@@ -21,20 +24,26 @@ class JobRouterAdministrationClientConfiguration: # pylint: disable=too-many-in
2124
2225
:param endpoint: Uri of your Communication resource. Required.
2326
:type endpoint: str
27+
:param credential: Credential used to authenticate requests to the service. Required.
28+
:type credential: ~azure.core.credentials.TokenCredential
2429
:keyword api_version: The API version to use for this operation. Default value is
2530
"2024-01-18-preview". Note that overriding this default value may result in unsupported
2631
behavior.
2732
:paramtype api_version: str
2833
"""
2934

30-
def __init__(self, endpoint: str, **kwargs: Any) -> None:
35+
def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None:
3136
api_version: str = kwargs.pop("api_version", "2024-01-18-preview")
3237

3338
if endpoint is None:
3439
raise ValueError("Parameter 'endpoint' must not be None.")
40+
if credential is None:
41+
raise ValueError("Parameter 'credential' must not be None.")
3542

3643
self.endpoint = endpoint
44+
self.credential = credential
3745
self.api_version = api_version
46+
self.credential_scopes = kwargs.pop("credential_scopes", ["https://communication.azure.com/.default"])
3847
kwargs.setdefault("sdk_moniker", "communication-jobrouter/{}".format(VERSION))
3948
self.polling_interval = kwargs.get("polling_interval", 30)
4049
self._configure(**kwargs)
@@ -49,30 +58,40 @@ def _configure(self, **kwargs: Any) -> None:
4958
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
5059
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
5160
self.authentication_policy = kwargs.get("authentication_policy")
61+
if self.credential and not self.authentication_policy:
62+
self.authentication_policy = policies.BearerTokenCredentialPolicy(
63+
self.credential, *self.credential_scopes, **kwargs
64+
)
5265

5366

54-
class JobRouterClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
67+
class JobRouterClientConfiguration: # pylint: disable=too-many-instance-attributes
5568
"""Configuration for JobRouterClient.
5669
5770
Note that all parameters used to create this instance are saved as instance
5871
attributes.
5972
6073
:param endpoint: Uri of your Communication resource. Required.
6174
:type endpoint: str
75+
:param credential: Credential used to authenticate requests to the service. Required.
76+
:type credential: ~azure.core.credentials.TokenCredential
6277
:keyword api_version: The API version to use for this operation. Default value is
6378
"2024-01-18-preview". Note that overriding this default value may result in unsupported
6479
behavior.
6580
:paramtype api_version: str
6681
"""
6782

68-
def __init__(self, endpoint: str, **kwargs: Any) -> None:
83+
def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None:
6984
api_version: str = kwargs.pop("api_version", "2024-01-18-preview")
7085

7186
if endpoint is None:
7287
raise ValueError("Parameter 'endpoint' must not be None.")
88+
if credential is None:
89+
raise ValueError("Parameter 'credential' must not be None.")
7390

7491
self.endpoint = endpoint
92+
self.credential = credential
7593
self.api_version = api_version
94+
self.credential_scopes = kwargs.pop("credential_scopes", ["https://communication.azure.com/.default"])
7695
kwargs.setdefault("sdk_moniker", "communication-jobrouter/{}".format(VERSION))
7796
self.polling_interval = kwargs.get("polling_interval", 30)
7897
self._configure(**kwargs)
@@ -87,3 +106,7 @@ def _configure(self, **kwargs: Any) -> None:
87106
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
88107
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
89108
self.authentication_policy = kwargs.get("authentication_policy")
109+
if self.credential and not self.authentication_policy:
110+
self.authentication_policy = policies.BearerTokenCredentialPolicy(
111+
self.credential, *self.credential_scopes, **kwargs
112+
)

sdk/communication/azure-communication-jobrouter/azure/communication/jobrouter/_operations/__init__.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,23 @@
55
# Code generated by Microsoft (R) Python Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
8+
# pylint: disable=wrong-import-position
89

9-
from ._patch import JobRouterAdministrationClientOperationsMixin
10-
from ._patch import JobRouterClientOperationsMixin
10+
from typing import TYPE_CHECKING
11+
12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
14+
15+
from ._operations import JobRouterAdministrationClientOperationsMixin # type: ignore
16+
from ._operations import JobRouterClientOperationsMixin # type: ignore
1117

1218
from ._patch import __all__ as _patch_all
13-
from ._patch import * # pylint: disable=unused-wildcard-import
19+
from ._patch import *
1420
from ._patch import patch_sdk as _patch_sdk
1521

1622
__all__ = [
1723
"JobRouterAdministrationClientOperationsMixin",
1824
"JobRouterClientOperationsMixin",
1925
]
20-
__all__.extend([p for p in _patch_all if p not in __all__])
26+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
2127
_patch_sdk()

0 commit comments

Comments
 (0)