Skip to content

Commit df1c244

Browse files
azure-sdkWzb123456789Zhenbiao Wei (WICRESOFT NORTH AMERICA LTD)
authored
[AutoRelease] t2-search-2022-10-28-64136(Do not merge) (Azure#27157)
* code and test * Update CHANGELOG.md * Update _version.py * update tests * update conftest.py * Update conftest.py * Update test_mgmt_search.pyTestMgmtSearchtest_search_admin_keys.json Co-authored-by: PythonSdkPipelines <PythonSdkPipelines> Co-authored-by: zhenbiao wei <424401670@qq.com> Co-authored-by: Zhenbiao Wei (WICRESOFT NORTH AMERICA LTD) <v-zhenbwei@microsoft.com>
1 parent 3012f59 commit df1c244

File tree

66 files changed

+7805
-5618
lines changed

Some content is hidden

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

66 files changed

+7805
-5618
lines changed

sdk/search/azure-mgmt-search/CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Release History
22

3+
## 9.0.0b1 (2022-10-28)
4+
5+
### Features Added
6+
7+
- Model Resource has a new parameter identity
8+
- Model Resource has a new parameter location
9+
- Model Resource has a new parameter tags
10+
11+
### Breaking Changes
12+
13+
- Model PrivateLinkResourceProperties no longer has parameter shareable_private_link_resource_types
14+
- Model SearchService no longer has parameter shared_private_link_resources
15+
- Removed operation group SharedPrivateLinkResourcesOperations
16+
317
## 8.0.0 (2020-12-22)
418

519
- GA release

sdk/search/azure-mgmt-search/MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
include _meta.json
22
recursive-include tests *.py *.json
3+
recursive-include samples *.py *.md
34
include *.md
45
include azure/__init__.py
56
include azure/mgmt/__init__.py
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"commit": "e82a24def11ffc98cc263884f9f1742c99f2df5e",
3+
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4+
"autorest": "3.9.2",
5+
"use": [
6+
"@autorest/python@6.2.1",
7+
"@autorest/modelerfour@4.24.3"
8+
],
9+
"autorest_command": "autorest specification/search/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --tag=package-2020-03 --use=@autorest/python@6.2.1 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
10+
"readme": "specification/search/resource-manager/readme.md"
11+
}

sdk/search/azure-mgmt-search/azure/mgmt/search/__init__.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,17 @@
1010
from ._version import VERSION
1111

1212
__version__ = VERSION
13-
__all__ = ['SearchManagementClient']
1413

1514
try:
16-
from ._patch import patch_sdk # type: ignore
17-
patch_sdk()
15+
from ._patch import __all__ as _patch_all
16+
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
1817
except ImportError:
19-
pass
18+
_patch_all = []
19+
from ._patch import patch_sdk as _patch_sdk
20+
21+
__all__ = [
22+
"SearchManagementClient",
23+
]
24+
__all__.extend([p for p in _patch_all if p not in __all__])
25+
26+
_patch_sdk()

sdk/search/azure-mgmt-search/azure/mgmt/search/_configuration.py

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

9-
from typing import TYPE_CHECKING
9+
import sys
10+
from typing import Any, TYPE_CHECKING
1011

1112
from azure.core.configuration import Configuration
1213
from azure.core.pipeline import policies
13-
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
14+
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
1415

1516
from ._version import VERSION
1617

18+
if sys.version_info >= (3, 8):
19+
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
20+
else:
21+
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
22+
1723
if TYPE_CHECKING:
1824
# pylint: disable=unused-import,ungrouped-imports
19-
from typing import Any
20-
2125
from azure.core.credentials import TokenCredential
2226

2327

24-
class SearchManagementClientConfiguration(Configuration):
28+
class SearchManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
2529
"""Configuration for SearchManagementClient.
2630
2731
Note that all parameters used to create this instance are saved as instance
2832
attributes.
2933
30-
:param credential: Credential needed for the client to connect to Azure.
34+
:param credential: Credential needed for the client to connect to Azure. Required.
3135
:type credential: ~azure.core.credentials.TokenCredential
32-
:param subscription_id: The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource Manager API or the portal.
36+
:param subscription_id: The unique identifier for a Microsoft Azure subscription. You can
37+
obtain this value from the Azure Resource Manager API or the portal. Required.
3338
:type subscription_id: str
39+
:keyword api_version: Api Version. Default value is "2020-03-13". Note that overriding this
40+
default value may result in unsupported behavior.
41+
:paramtype api_version: str
3442
"""
3543

36-
def __init__(
37-
self,
38-
credential, # type: "TokenCredential"
39-
subscription_id, # type: str
40-
**kwargs # type: Any
41-
):
42-
# type: (...) -> None
44+
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
45+
super(SearchManagementClientConfiguration, self).__init__(**kwargs)
46+
api_version = kwargs.pop("api_version", "2020-03-13") # type: Literal["2020-03-13"]
47+
4348
if credential is None:
4449
raise ValueError("Parameter 'credential' must not be None.")
4550
if subscription_id is None:
4651
raise ValueError("Parameter 'subscription_id' must not be None.")
47-
super(SearchManagementClientConfiguration, self).__init__(**kwargs)
4852

4953
self.credential = credential
5054
self.subscription_id = subscription_id
51-
self.api_version = "2020-08-01"
52-
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
53-
kwargs.setdefault('sdk_moniker', 'mgmt-search/{}'.format(VERSION))
55+
self.api_version = api_version
56+
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
57+
kwargs.setdefault("sdk_moniker", "mgmt-search/{}".format(VERSION))
5458
self._configure(**kwargs)
5559

5660
def _configure(
57-
self,
58-
**kwargs # type: Any
61+
self, **kwargs # type: Any
5962
):
6063
# type: (...) -> None
61-
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
62-
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
63-
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
64-
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
65-
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
66-
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
67-
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
68-
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
69-
self.authentication_policy = kwargs.get('authentication_policy')
64+
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
65+
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
66+
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
67+
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
68+
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
69+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
70+
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
71+
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
72+
self.authentication_policy = kwargs.get("authentication_policy")
7073
if self.credential and not self.authentication_policy:
71-
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
74+
self.authentication_policy = ARMChallengeAuthenticationPolicy(
75+
self.credential, *self.credential_scopes, **kwargs
76+
)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# ------------------------------------
2+
# Copyright (c) Microsoft Corporation.
3+
# Licensed under the MIT License.
4+
# ------------------------------------
5+
"""Customize generated code here.
6+
7+
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
8+
"""
9+
from typing import List
10+
11+
__all__: List[str] = [] # Add all objects you want publicly available to users at this package level
12+
13+
14+
def patch_sdk():
15+
"""Do not remove from this file.
16+
17+
`patch_sdk` is a last resort escape hatch that allows you to do customizations
18+
you can't accomplish using the techniques described in
19+
https://aka.ms/azsdk/python/dpcodegen/python/customize
20+
"""

sdk/search/azure-mgmt-search/azure/mgmt/search/_search_management_client.py

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

9-
from typing import TYPE_CHECKING
9+
from copy import deepcopy
10+
from typing import Any, TYPE_CHECKING
1011

12+
from azure.core.rest import HttpRequest, HttpResponse
1113
from azure.mgmt.core import ARMPipelineClient
12-
from msrest import Deserializer, Serializer
14+
15+
from . import models
16+
from ._configuration import SearchManagementClientConfiguration
17+
from ._serialization import Deserializer, Serializer
18+
from .operations import (
19+
AdminKeysOperations,
20+
Operations,
21+
PrivateEndpointConnectionsOperations,
22+
PrivateLinkResourcesOperations,
23+
QueryKeysOperations,
24+
ServicesOperations,
25+
)
1326

1427
if TYPE_CHECKING:
1528
# pylint: disable=unused-import,ungrouped-imports
16-
from typing import Any, Optional
17-
1829
from azure.core.credentials import TokenCredential
1930

20-
from ._configuration import SearchManagementClientConfiguration
21-
from .operations import Operations
22-
from .operations import AdminKeysOperations
23-
from .operations import QueryKeysOperations
24-
from .operations import ServicesOperations
25-
from .operations import PrivateLinkResourcesOperations
26-
from .operations import PrivateEndpointConnectionsOperations
27-
from .operations import SharedPrivateLinkResourcesOperations
28-
from . import models
2931

30-
31-
class SearchManagementClient(object):
32+
class SearchManagementClient: # pylint: disable=client-accepts-api-version-keyword
3233
"""Client that can be used to manage Azure Cognitive Search services and API keys.
3334
3435
:ivar operations: Operations operations
@@ -42,49 +43,70 @@ class SearchManagementClient(object):
4243
:ivar private_link_resources: PrivateLinkResourcesOperations operations
4344
:vartype private_link_resources: azure.mgmt.search.operations.PrivateLinkResourcesOperations
4445
:ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
45-
:vartype private_endpoint_connections: azure.mgmt.search.operations.PrivateEndpointConnectionsOperations
46-
:ivar shared_private_link_resources: SharedPrivateLinkResourcesOperations operations
47-
:vartype shared_private_link_resources: azure.mgmt.search.operations.SharedPrivateLinkResourcesOperations
48-
:param credential: Credential needed for the client to connect to Azure.
46+
:vartype private_endpoint_connections:
47+
azure.mgmt.search.operations.PrivateEndpointConnectionsOperations
48+
:param credential: Credential needed for the client to connect to Azure. Required.
4949
:type credential: ~azure.core.credentials.TokenCredential
50-
:param subscription_id: The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource Manager API or the portal.
50+
:param subscription_id: The unique identifier for a Microsoft Azure subscription. You can
51+
obtain this value from the Azure Resource Manager API or the portal. Required.
5152
:type subscription_id: str
52-
:param str base_url: Service URL
53-
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
53+
:param base_url: Service URL. Default value is "https://management.azure.com".
54+
:type base_url: str
55+
:keyword api_version: Api Version. Default value is "2020-03-13". Note that overriding this
56+
default value may result in unsupported behavior.
57+
:paramtype api_version: str
58+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
59+
Retry-After header is present.
5460
"""
5561

5662
def __init__(
5763
self,
58-
credential, # type: "TokenCredential"
59-
subscription_id, # type: str
60-
base_url=None, # type: Optional[str]
61-
**kwargs # type: Any
62-
):
63-
# type: (...) -> None
64-
if not base_url:
65-
base_url = 'https://management.azure.com'
66-
self._config = SearchManagementClientConfiguration(credential, subscription_id, **kwargs)
64+
credential: "TokenCredential",
65+
subscription_id: str,
66+
base_url: str = "https://management.azure.com",
67+
**kwargs: Any
68+
) -> None:
69+
self._config = SearchManagementClientConfiguration(
70+
credential=credential, subscription_id=subscription_id, **kwargs
71+
)
6772
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
6873

6974
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
7075
self._serialize = Serializer(client_models)
71-
self._serialize.client_side_validation = False
7276
self._deserialize = Deserializer(client_models)
73-
74-
self.operations = Operations(
75-
self._client, self._config, self._serialize, self._deserialize)
76-
self.admin_keys = AdminKeysOperations(
77-
self._client, self._config, self._serialize, self._deserialize)
78-
self.query_keys = QueryKeysOperations(
79-
self._client, self._config, self._serialize, self._deserialize)
80-
self.services = ServicesOperations(
81-
self._client, self._config, self._serialize, self._deserialize)
77+
self._serialize.client_side_validation = False
78+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
79+
self.admin_keys = AdminKeysOperations(self._client, self._config, self._serialize, self._deserialize)
80+
self.query_keys = QueryKeysOperations(self._client, self._config, self._serialize, self._deserialize)
81+
self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize)
8282
self.private_link_resources = PrivateLinkResourcesOperations(
83-
self._client, self._config, self._serialize, self._deserialize)
83+
self._client, self._config, self._serialize, self._deserialize
84+
)
8485
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(
85-
self._client, self._config, self._serialize, self._deserialize)
86-
self.shared_private_link_resources = SharedPrivateLinkResourcesOperations(
87-
self._client, self._config, self._serialize, self._deserialize)
86+
self._client, self._config, self._serialize, self._deserialize
87+
)
88+
89+
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
90+
"""Runs the network request through the client's chained policies.
91+
92+
>>> from azure.core.rest import HttpRequest
93+
>>> request = HttpRequest("GET", "https://www.example.org/")
94+
<HttpRequest [GET], url: 'https://www.example.org/'>
95+
>>> response = client._send_request(request)
96+
<HttpResponse: 200 OK>
97+
98+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
99+
100+
:param request: The network request you want to make. Required.
101+
:type request: ~azure.core.rest.HttpRequest
102+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
103+
:return: The response of your network call. Does not do error handling on your response.
104+
:rtype: ~azure.core.rest.HttpResponse
105+
"""
106+
107+
request_copy = deepcopy(request)
108+
request_copy.url = self._client.format_url(request_copy.url)
109+
return self._client.send_request(request_copy, **kwargs)
88110

89111
def close(self):
90112
# type: () -> None

0 commit comments

Comments
 (0)