diff --git a/sdk/search/azure-mgmt-search/CHANGELOG.md b/sdk/search/azure-mgmt-search/CHANGELOG.md index 740ed3ca7087..287d157e38ff 100644 --- a/sdk/search/azure-mgmt-search/CHANGELOG.md +++ b/sdk/search/azure-mgmt-search/CHANGELOG.md @@ -1,5 +1,54 @@ # Release History +## 8.0.0b1 (2019-05-24) + +This is beta preview version. + +This version uses a next-generation code generator that introduces important breaking changes, but also important new features (like unified authentication and async programming). + +**General breaking changes** + +- Credential system has been completly revamped: + + - `azure.common.credentials` or `msrestazure.azure_active_directory` instances are no longer supported, use the `azure-identity` classes instead: https://pypi.org/project/azure-identity/ + - `credentials` parameter has been renamed `credential` + +- The `config` attribute no longer exists on a client, configuration should be passed as kwarg. Example: `MyClient(credential, subscription_id, enable_logging=True)`. For a complete set of + supported options, see the [parameters accept in init documentation of azure-core](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies) +- You can't import a `version` module anymore, use `__version__` instead +- Operations that used to return a `msrest.polling.LROPoller` now returns a `azure.core.polling.LROPoller` and are prefixed with `begin_`. +- Exceptions tree have been simplified and most exceptions are now `azure.core.exceptions.HttpResponseError` (`CloudError` has been removed). +- Most of the operation kwarg have changed. Some of the most noticeable: + + - `raw` has been removed. Equivalent feature can be found using `cls`, a callback that will give access to internal HTTP response for advanced user + - For a complete set of + supported options, see the [parameters accept in Request documentation of azure-core](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies) + +**General new features** + +- Type annotations support using `typing`. SDKs are mypy ready. +- This client has now stable and official support for async. Check the `aio` namespace of your package to find the async client. +- This client now support natively tracing library like OpenCensus or OpenTelemetry. See this [tracing quickstart](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/core/azure-core-tracing-opentelemetry) for an overview. + +## 3.0.0 (2019-09-28) + +**Features** + + - Model SearchService has a new parameter shared_private_link_resources + - Model SearchService has a new parameter public_network_access + - Model SearchService has a new parameter private_endpoint_connections + - Model SearchService has a new parameter network_rule_set + - Added operation group PrivateEndpointConnectionsOperations + - Added operation group PrivateLinkResourcesOperations + - Added operation group SharedPrivateLinkResourcesOperations + +**Breaking changes** + + - Parameter location of model SearchService is now required + - Model Resource no longer has parameter location + - Model Resource no longer has parameter identity + - Model Resource no longer has parameter tags + ## 2.1.0 (2019-05-24) **Features** diff --git a/sdk/search/azure-mgmt-search/README.md b/sdk/search/azure-mgmt-search/README.md index 503608414dae..9cdf95bcd8b6 100644 --- a/sdk/search/azure-mgmt-search/README.md +++ b/sdk/search/azure-mgmt-search/README.md @@ -16,9 +16,15 @@ For a more complete set of Azure libraries, see the ## Usage -For code examples, see [Search -Management](https://docs.microsoft.com/python/api/overview/azure/search) -on docs.microsoft.com. + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [Search Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + ## Provide Feedback diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/__init__.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/__init__.py index 3c614360eda6..bcfbc4ac70f1 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/__init__.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/__init__.py @@ -1,18 +1,19 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from .search_management_client import SearchManagementClient -from .version import VERSION - -__all__ = ['SearchManagementClient'] +from ._search_management_client import SearchManagementClient +from ._version import VERSION __version__ = VERSION +__all__ = ['SearchManagementClient'] +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/_configuration.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/_configuration.py new file mode 100644 index 000000000000..7739f74e4c79 --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/_configuration.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class SearchManagementClientConfiguration(Configuration): + """Configuration for SearchManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :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. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(SearchManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-08-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-search/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + 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 ARMHttpLoggingPolicy(**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.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/_search_management_client.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/_search_management_client.py new file mode 100644 index 000000000000..99b4e7bf9ed9 --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/_search_management_client.py @@ -0,0 +1,100 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + +from ._configuration import SearchManagementClientConfiguration +from .operations import Operations +from .operations import AdminKeysOperations +from .operations import QueryKeysOperations +from .operations import ServicesOperations +from .operations import PrivateLinkResourcesOperations +from .operations import PrivateEndpointConnectionsOperations +from .operations import SharedPrivateLinkResourcesOperations +from . import models + + +class SearchManagementClient(object): + """Client that can be used to manage Azure Cognitive Search services and API keys. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.search.operations.Operations + :ivar admin_keys: AdminKeysOperations operations + :vartype admin_keys: azure.mgmt.search.operations.AdminKeysOperations + :ivar query_keys: QueryKeysOperations operations + :vartype query_keys: azure.mgmt.search.operations.QueryKeysOperations + :ivar services: ServicesOperations operations + :vartype services: azure.mgmt.search.operations.ServicesOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: azure.mgmt.search.operations.PrivateLinkResourcesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.search.operations.PrivateEndpointConnectionsOperations + :ivar shared_private_link_resources: SharedPrivateLinkResourcesOperations operations + :vartype shared_private_link_resources: azure.mgmt.search.operations.SharedPrivateLinkResourcesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :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. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = SearchManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.admin_keys = AdminKeysOperations( + self._client, self._config, self._serialize, self._deserialize) + self.query_keys = QueryKeysOperations( + self._client, self._config, self._serialize, self._deserialize) + self.services = ServicesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.shared_private_link_resources = SharedPrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> SearchManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/version.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/_version.py similarity index 84% rename from sdk/search/azure-mgmt-search/azure/mgmt/search/version.py rename to sdk/search/azure-mgmt-search/azure/mgmt/search/_version.py index be75d8eae586..0d5779dc14de 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/version.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/_version.py @@ -1,13 +1,9 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.1.0" - +VERSION = "8.0.0b1" diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/__init__.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/__init__.py new file mode 100644 index 000000000000..399efc6e18c8 --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._search_management_client import SearchManagementClient +__all__ = ['SearchManagementClient'] diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_configuration.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_configuration.py new file mode 100644 index 000000000000..7ee7568b61a0 --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class SearchManagementClientConfiguration(Configuration): + """Configuration for SearchManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :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. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(SearchManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-08-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-search/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + 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 ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_search_management_client.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_search_management_client.py new file mode 100644 index 000000000000..661e7fc7197a --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_search_management_client.py @@ -0,0 +1,94 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import SearchManagementClientConfiguration +from .operations import Operations +from .operations import AdminKeysOperations +from .operations import QueryKeysOperations +from .operations import ServicesOperations +from .operations import PrivateLinkResourcesOperations +from .operations import PrivateEndpointConnectionsOperations +from .operations import SharedPrivateLinkResourcesOperations +from .. import models + + +class SearchManagementClient(object): + """Client that can be used to manage Azure Cognitive Search services and API keys. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.search.aio.operations.Operations + :ivar admin_keys: AdminKeysOperations operations + :vartype admin_keys: azure.mgmt.search.aio.operations.AdminKeysOperations + :ivar query_keys: QueryKeysOperations operations + :vartype query_keys: azure.mgmt.search.aio.operations.QueryKeysOperations + :ivar services: ServicesOperations operations + :vartype services: azure.mgmt.search.aio.operations.ServicesOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: azure.mgmt.search.aio.operations.PrivateLinkResourcesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.search.aio.operations.PrivateEndpointConnectionsOperations + :ivar shared_private_link_resources: SharedPrivateLinkResourcesOperations operations + :vartype shared_private_link_resources: azure.mgmt.search.aio.operations.SharedPrivateLinkResourcesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :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. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = SearchManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.admin_keys = AdminKeysOperations( + self._client, self._config, self._serialize, self._deserialize) + self.query_keys = QueryKeysOperations( + self._client, self._config, self._serialize, self._deserialize) + self.services = ServicesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.shared_private_link_resources = SharedPrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "SearchManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/__init__.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/__init__.py new file mode 100644 index 000000000000..7cef1dd388a1 --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._admin_keys_operations import AdminKeysOperations +from ._query_keys_operations import QueryKeysOperations +from ._services_operations import ServicesOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._shared_private_link_resources_operations import SharedPrivateLinkResourcesOperations + +__all__ = [ + 'Operations', + 'AdminKeysOperations', + 'QueryKeysOperations', + 'ServicesOperations', + 'PrivateLinkResourcesOperations', + 'PrivateEndpointConnectionsOperations', + 'SharedPrivateLinkResourcesOperations', +] diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_admin_keys_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_admin_keys_operations.py new file mode 100644 index 000000000000..e286518693dc --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_admin_keys_operations.py @@ -0,0 +1,185 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AdminKeysOperations: + """AdminKeysOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.search.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + search_service_name: str, + search_management_request_options: Optional["models.SearchManagementRequestOptions"] = None, + **kwargs + ) -> "models.AdminKeyResult": + """Gets the primary and secondary admin API keys for the specified Azure Cognitive Search service. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AdminKeyResult, or the result of cls(response) + :rtype: ~azure.mgmt.search.models.AdminKeyResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AdminKeyResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AdminKeyResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listAdminKeys'} # type: ignore + + async def regenerate( + self, + resource_group_name: str, + search_service_name: str, + key_kind: Union[str, "models.AdminKeyKind"], + search_management_request_options: Optional["models.SearchManagementRequestOptions"] = None, + **kwargs + ) -> "models.AdminKeyResult": + """Regenerates either the primary or secondary admin API key. You can only regenerate one key at a + time. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param key_kind: Specifies which key to regenerate. Valid values include 'primary' and + 'secondary'. + :type key_kind: str or ~azure.mgmt.search.models.AdminKeyKind + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AdminKeyResult, or the result of cls(response) + :rtype: ~azure.mgmt.search.models.AdminKeyResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AdminKeyResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + # Construct URL + url = self.regenerate.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + 'keyKind': self._serialize.url("key_kind", key_kind, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AdminKeyResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/regenerateAdminKey/{keyKind}'} # type: ignore diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_operations.py new file mode 100644 index 000000000000..a210c53cd9e2 --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_operations.py @@ -0,0 +1,104 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.search.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs + ) -> AsyncIterable["models.OperationListResult"]: + """Lists all of the available REST API operations of the Microsoft.Search provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.search.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Search/operations'} # type: ignore diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_private_endpoint_connections_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..f285072d762b --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,361 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsOperations: + """PrivateEndpointConnectionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.search.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def update( + self, + resource_group_name: str, + search_service_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "models.PrivateEndpointConnection", + search_management_request_options: Optional["models.SearchManagementRequestOptions"] = None, + **kwargs + ) -> "models.PrivateEndpointConnection": + """Updates a Private Endpoint connection to the search service in the given resource group. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection to the + Azure Cognitive Search service with the specified resource group. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The definition of the private endpoint connection to + update. + :type private_endpoint_connection: ~azure.mgmt.search.models.PrivateEndpointConnection + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + search_service_name: str, + private_endpoint_connection_name: str, + search_management_request_options: Optional["models.SearchManagementRequestOptions"] = None, + **kwargs + ) -> "models.PrivateEndpointConnection": + """Gets the details of the private endpoint connection to the search service in the given resource + group. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection to the + Azure Cognitive Search service with the specified resource group. + :type private_endpoint_connection_name: str + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + search_service_name: str, + private_endpoint_connection_name: str, + search_management_request_options: Optional["models.SearchManagementRequestOptions"] = None, + **kwargs + ) -> Optional["models.PrivateEndpointConnection"]: + """Disconnects the private endpoint connection and deletes it from the search service. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection to the + Azure Cognitive Search service with the specified resource group. + :type private_endpoint_connection_name: str + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PrivateEndpointConnection"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def list_by_service( + self, + resource_group_name: str, + search_service_name: str, + search_management_request_options: Optional["models.SearchManagementRequestOptions"] = None, + **kwargs + ) -> AsyncIterable["models.PrivateEndpointConnectionListResult"]: + """Gets a list of all private endpoint connections in the given service. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.search.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_service.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections'} # type: ignore diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_private_link_resources_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..fc64d60034de --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_private_link_resources_operations.py @@ -0,0 +1,127 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateLinkResourcesOperations: + """PrivateLinkResourcesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.search.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_supported( + self, + resource_group_name: str, + search_service_name: str, + search_management_request_options: Optional["models.SearchManagementRequestOptions"] = None, + **kwargs + ) -> AsyncIterable["models.PrivateLinkResourcesResult"]: + """Gets a list of all supported private link resource types for the given service. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateLinkResourcesResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.search.models.PrivateLinkResourcesResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourcesResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_supported.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateLinkResourcesResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_supported.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateLinkResources'} # type: ignore diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_query_keys_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_query_keys_operations.py new file mode 100644 index 000000000000..4cef2006984f --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_query_keys_operations.py @@ -0,0 +1,272 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class QueryKeysOperations: + """QueryKeysOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.search.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def create( + self, + resource_group_name: str, + search_service_name: str, + name: str, + search_management_request_options: Optional["models.SearchManagementRequestOptions"] = None, + **kwargs + ) -> "models.QueryKey": + """Generates a new query key for the specified search service. You can create up to 50 query keys + per service. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param name: The name of the new query API key. + :type name: str + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QueryKey, or the result of cls(response) + :rtype: ~azure.mgmt.search.models.QueryKey + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.QueryKey"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('QueryKey', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/createQueryKey/{name}'} # type: ignore + + def list_by_search_service( + self, + resource_group_name: str, + search_service_name: str, + search_management_request_options: Optional["models.SearchManagementRequestOptions"] = None, + **kwargs + ) -> AsyncIterable["models.ListQueryKeysResult"]: + """Returns the list of query API keys for the given Azure Cognitive Search service. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ListQueryKeysResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.search.models.ListQueryKeysResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ListQueryKeysResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_search_service.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ListQueryKeysResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_search_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listQueryKeys'} # type: ignore + + async def delete( + self, + resource_group_name: str, + search_service_name: str, + key: str, + search_management_request_options: Optional["models.SearchManagementRequestOptions"] = None, + **kwargs + ) -> None: + """Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process + for regenerating a query key is to delete and then recreate it. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param key: The query key to be deleted. Query keys are identified by value, not by name. + :type key: str + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + 'key': self._serialize.url("key", key, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/deleteQueryKey/{key}'} # type: ignore diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_services_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_services_operations.py new file mode 100644 index 000000000000..235c212a49f7 --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_services_operations.py @@ -0,0 +1,623 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ServicesOperations: + """ServicesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.search.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _create_or_update_initial( + self, + resource_group_name: str, + search_service_name: str, + service: "models.SearchService", + search_management_request_options: Optional["models.SearchManagementRequestOptions"] = None, + **kwargs + ) -> "models.SearchService": + cls = kwargs.pop('cls', None) # type: ClsType["models.SearchService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(service, 'SearchService') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SearchService', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SearchService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + search_service_name: str, + service: "models.SearchService", + search_management_request_options: Optional["models.SearchManagementRequestOptions"] = None, + **kwargs + ) -> AsyncLROPoller["models.SearchService"]: + """Creates or updates a search service in the given resource group. If the search service already + exists, all properties will be updated with the given values. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service to create or update. + Search service names must only contain lowercase letters, digits or dashes, cannot use dash as + the first two or last one characters, cannot contain consecutive dashes, and must be between 2 + and 60 characters in length. Search service names must be globally unique since they are part + of the service URI (https://:code:``.search.windows.net). You cannot change the service + name after the service is created. + :type search_service_name: str + :param service: The definition of the search service to create or update. + :type service: ~azure.mgmt.search.models.SearchService + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SearchService or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.search.models.SearchService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.SearchService"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + service=service, + search_management_request_options=search_management_request_options, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SearchService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + search_service_name: str, + service: "models.SearchServiceUpdate", + search_management_request_options: Optional["models.SearchManagementRequestOptions"] = None, + **kwargs + ) -> "models.SearchService": + """Updates an existing search service in the given resource group. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service to update. + :type search_service_name: str + :param service: The definition of the search service to update. + :type service: ~azure.mgmt.search.models.SearchServiceUpdate + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchService, or the result of cls(response) + :rtype: ~azure.mgmt.search.models.SearchService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SearchService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(service, 'SearchServiceUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SearchService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + search_service_name: str, + search_management_request_options: Optional["models.SearchManagementRequestOptions"] = None, + **kwargs + ) -> "models.SearchService": + """Gets the search service with the given name in the given resource group. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchService, or the result of cls(response) + :rtype: ~azure.mgmt.search.models.SearchService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SearchService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SearchService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + search_service_name: str, + search_management_request_options: Optional["models.SearchManagementRequestOptions"] = None, + **kwargs + ) -> None: + """Deletes a search service in the given resource group, along with its associated resources. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + search_management_request_options: Optional["models.SearchManagementRequestOptions"] = None, + **kwargs + ) -> AsyncIterable["models.SearchServiceListResult"]: + """Gets a list of all search services in the given resource group. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SearchServiceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.search.models.SearchServiceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SearchServiceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SearchServiceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices'} # type: ignore + + def list_by_subscription( + self, + search_management_request_options: Optional["models.SearchManagementRequestOptions"] = None, + **kwargs + ) -> AsyncIterable["models.SearchServiceListResult"]: + """Gets a list of all search services in the given subscription. + + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SearchServiceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.search.models.SearchServiceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SearchServiceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SearchServiceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Search/searchServices'} # type: ignore + + async def check_name_availability( + self, + name: str, + search_management_request_options: Optional["models.SearchManagementRequestOptions"] = None, + **kwargs + ) -> "models.CheckNameAvailabilityOutput": + """Checks whether or not the given search service name is available for use. Search service names + must be globally unique since they are part of the service URI + (https://:code:``.search.windows.net). + + :param name: The search service name to validate. Search service names must only contain + lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, + cannot contain consecutive dashes, and must be between 2 and 60 characters in length. + :type name: str + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityOutput, or the result of cls(response) + :rtype: ~azure.mgmt.search.models.CheckNameAvailabilityOutput + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityOutput"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + + _check_name_availability_input = models.CheckNameAvailabilityInput(name=name) + api_version = "2020-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_check_name_availability_input, 'CheckNameAvailabilityInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityOutput', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Search/checkNameAvailability'} # type: ignore diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_shared_private_link_resources_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_shared_private_link_resources_operations.py new file mode 100644 index 000000000000..20892e560b73 --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_shared_private_link_resources_operations.py @@ -0,0 +1,468 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SharedPrivateLinkResourcesOperations: + """SharedPrivateLinkResourcesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.search.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _create_or_update_initial( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + shared_private_link_resource: "models.SharedPrivateLinkResource", + search_management_request_options: Optional["models.SearchManagementRequestOptions"] = None, + **kwargs + ) -> Optional["models.SharedPrivateLinkResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SharedPrivateLinkResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + 'sharedPrivateLinkResourceName': self._serialize.url("shared_private_link_resource_name", shared_private_link_resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(shared_private_link_resource, 'SharedPrivateLinkResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SharedPrivateLinkResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + shared_private_link_resource: "models.SharedPrivateLinkResource", + search_management_request_options: Optional["models.SearchManagementRequestOptions"] = None, + **kwargs + ) -> AsyncLROPoller["models.SharedPrivateLinkResource"]: + """Initiates the creation or update of a shared private link resource managed by the search + service in the given resource group. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param shared_private_link_resource_name: The name of the shared private link resource managed + by the Azure Cognitive Search service within the specified resource group. + :type shared_private_link_resource_name: str + :param shared_private_link_resource: The definition of the shared private link resource to + create or update. + :type shared_private_link_resource: ~azure.mgmt.search.models.SharedPrivateLinkResource + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SharedPrivateLinkResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.search.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.SharedPrivateLinkResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, + shared_private_link_resource=shared_private_link_resource, + search_management_request_options=search_management_request_options, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SharedPrivateLinkResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + search_management_request_options: Optional["models.SearchManagementRequestOptions"] = None, + **kwargs + ) -> "models.SharedPrivateLinkResource": + """Gets the details of the shared private link resource managed by the search service in the given + resource group. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param shared_private_link_resource_name: The name of the shared private link resource managed + by the Azure Cognitive Search service within the specified resource group. + :type shared_private_link_resource_name: str + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedPrivateLinkResource, or the result of cls(response) + :rtype: ~azure.mgmt.search.models.SharedPrivateLinkResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SharedPrivateLinkResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + 'sharedPrivateLinkResourceName': self._serialize.url("shared_private_link_resource_name", shared_private_link_resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedPrivateLinkResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + search_management_request_options: Optional["models.SearchManagementRequestOptions"] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + 'sharedPrivateLinkResourceName': self._serialize.url("shared_private_link_resource_name", shared_private_link_resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + search_management_request_options: Optional["models.SearchManagementRequestOptions"] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """Initiates the deletion of the shared private link resource from the search service. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param shared_private_link_resource_name: The name of the shared private link resource managed + by the Azure Cognitive Search service within the specified resource group. + :type shared_private_link_resource_name: str + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, + search_management_request_options=search_management_request_options, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore + + def list_by_service( + self, + resource_group_name: str, + search_service_name: str, + search_management_request_options: Optional["models.SearchManagementRequestOptions"] = None, + **kwargs + ) -> AsyncIterable["models.SharedPrivateLinkResourceListResult"]: + """Gets a list of all shared private link resources managed by the given service. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedPrivateLinkResourceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.search.models.SharedPrivateLinkResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SharedPrivateLinkResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_service.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SharedPrivateLinkResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources'} # type: ignore diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/__init__.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/__init__.py index d09b7141363d..6c96a589b8c8 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/__init__.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/__init__.py @@ -1,71 +1,139 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- try: - from .check_name_availability_input_py3 import CheckNameAvailabilityInput - from .check_name_availability_output_py3 import CheckNameAvailabilityOutput - from .admin_key_result_py3 import AdminKeyResult - from .query_key_py3 import QueryKey - from .sku_py3 import Sku - from .search_service_py3 import SearchService - from .identity_py3 import Identity - from .resource_py3 import Resource - from .operation_display_py3 import OperationDisplay - from .operation_py3 import Operation - from .search_management_request_options_py3 import SearchManagementRequestOptions + from ._models_py3 import AdminKeyResult + from ._models_py3 import AsyncOperationResult + from ._models_py3 import CheckNameAvailabilityInput + from ._models_py3 import CheckNameAvailabilityOutput + from ._models_py3 import CloudErrorBody + from ._models_py3 import Identity + from ._models_py3 import IpRule + from ._models_py3 import ListQueryKeysResult + from ._models_py3 import NetworkRuleSet + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult + from ._models_py3 import PrivateEndpointConnection + from ._models_py3 import PrivateEndpointConnectionListResult + from ._models_py3 import PrivateEndpointConnectionProperties + from ._models_py3 import PrivateEndpointConnectionPropertiesPrivateEndpoint + from ._models_py3 import PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState + from ._models_py3 import PrivateLinkResource + from ._models_py3 import PrivateLinkResourceProperties + from ._models_py3 import PrivateLinkResourcesResult + from ._models_py3 import QueryKey + from ._models_py3 import Resource + from ._models_py3 import SearchManagementRequestOptions + from ._models_py3 import SearchService + from ._models_py3 import SearchServiceListResult + from ._models_py3 import SearchServiceUpdate + from ._models_py3 import ShareablePrivateLinkResourceProperties + from ._models_py3 import ShareablePrivateLinkResourceType + from ._models_py3 import SharedPrivateLinkResource + from ._models_py3 import SharedPrivateLinkResourceListResult + from ._models_py3 import SharedPrivateLinkResourceProperties + from ._models_py3 import Sku + from ._models_py3 import TrackedResource except (SyntaxError, ImportError): - from .check_name_availability_input import CheckNameAvailabilityInput - from .check_name_availability_output import CheckNameAvailabilityOutput - from .admin_key_result import AdminKeyResult - from .query_key import QueryKey - from .sku import Sku - from .search_service import SearchService - from .identity import Identity - from .resource import Resource - from .operation_display import OperationDisplay - from .operation import Operation - from .search_management_request_options import SearchManagementRequestOptions -from .operation_paged import OperationPaged -from .query_key_paged import QueryKeyPaged -from .search_service_paged import SearchServicePaged -from .search_management_client_enums import ( - UnavailableNameReason, - SkuName, + from ._models import AdminKeyResult # type: ignore + from ._models import AsyncOperationResult # type: ignore + from ._models import CheckNameAvailabilityInput # type: ignore + from ._models import CheckNameAvailabilityOutput # type: ignore + from ._models import CloudErrorBody # type: ignore + from ._models import Identity # type: ignore + from ._models import IpRule # type: ignore + from ._models import ListQueryKeysResult # type: ignore + from ._models import NetworkRuleSet # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationListResult # type: ignore + from ._models import PrivateEndpointConnection # type: ignore + from ._models import PrivateEndpointConnectionListResult # type: ignore + from ._models import PrivateEndpointConnectionProperties # type: ignore + from ._models import PrivateEndpointConnectionPropertiesPrivateEndpoint # type: ignore + from ._models import PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState # type: ignore + from ._models import PrivateLinkResource # type: ignore + from ._models import PrivateLinkResourceProperties # type: ignore + from ._models import PrivateLinkResourcesResult # type: ignore + from ._models import QueryKey # type: ignore + from ._models import Resource # type: ignore + from ._models import SearchManagementRequestOptions # type: ignore + from ._models import SearchService # type: ignore + from ._models import SearchServiceListResult # type: ignore + from ._models import SearchServiceUpdate # type: ignore + from ._models import ShareablePrivateLinkResourceProperties # type: ignore + from ._models import ShareablePrivateLinkResourceType # type: ignore + from ._models import SharedPrivateLinkResource # type: ignore + from ._models import SharedPrivateLinkResourceListResult # type: ignore + from ._models import SharedPrivateLinkResourceProperties # type: ignore + from ._models import Sku # type: ignore + from ._models import TrackedResource # type: ignore + +from ._search_management_client_enums import ( + AdminKeyKind, HostingMode, - SearchServiceStatus, - ProvisioningState, IdentityType, - AdminKeyKind, + PrivateLinkServiceConnectionStatus, + ProvisioningState, + PublicNetworkAccess, + SearchServiceStatus, + SharedPrivateLinkResourceAsyncOperationResult, + SharedPrivateLinkResourceProvisioningState, + SharedPrivateLinkResourceStatus, + SkuName, + UnavailableNameReason, ) __all__ = [ + 'AdminKeyResult', + 'AsyncOperationResult', 'CheckNameAvailabilityInput', 'CheckNameAvailabilityOutput', - 'AdminKeyResult', - 'QueryKey', - 'Sku', - 'SearchService', + 'CloudErrorBody', 'Identity', - 'Resource', - 'OperationDisplay', + 'IpRule', + 'ListQueryKeysResult', + 'NetworkRuleSet', 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'PrivateEndpointConnection', + 'PrivateEndpointConnectionListResult', + 'PrivateEndpointConnectionProperties', + 'PrivateEndpointConnectionPropertiesPrivateEndpoint', + 'PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState', + 'PrivateLinkResource', + 'PrivateLinkResourceProperties', + 'PrivateLinkResourcesResult', + 'QueryKey', + 'Resource', 'SearchManagementRequestOptions', - 'OperationPaged', - 'QueryKeyPaged', - 'SearchServicePaged', - 'UnavailableNameReason', - 'SkuName', + 'SearchService', + 'SearchServiceListResult', + 'SearchServiceUpdate', + 'ShareablePrivateLinkResourceProperties', + 'ShareablePrivateLinkResourceType', + 'SharedPrivateLinkResource', + 'SharedPrivateLinkResourceListResult', + 'SharedPrivateLinkResourceProperties', + 'Sku', + 'TrackedResource', + 'AdminKeyKind', 'HostingMode', - 'SearchServiceStatus', - 'ProvisioningState', 'IdentityType', - 'AdminKeyKind', + 'PrivateLinkServiceConnectionStatus', + 'ProvisioningState', + 'PublicNetworkAccess', + 'SearchServiceStatus', + 'SharedPrivateLinkResourceAsyncOperationResult', + 'SharedPrivateLinkResourceProvisioningState', + 'SharedPrivateLinkResourceStatus', + 'SkuName', + 'UnavailableNameReason', ] diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_models.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_models.py new file mode 100644 index 000000000000..4c9ec1b5928b --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_models.py @@ -0,0 +1,1276 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import msrest.serialization + + +class AdminKeyResult(msrest.serialization.Model): + """Response containing the primary and secondary admin API keys for a given Azure Cognitive Search service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar primary_key: The primary admin API key of the search service. + :vartype primary_key: str + :ivar secondary_key: The secondary admin API key of the search service. + :vartype secondary_key: str + """ + + _validation = { + 'primary_key': {'readonly': True}, + 'secondary_key': {'readonly': True}, + } + + _attribute_map = { + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AdminKeyResult, self).__init__(**kwargs) + self.primary_key = None + self.secondary_key = None + + +class AsyncOperationResult(msrest.serialization.Model): + """The details of a long running asynchronous shared private link resource operation. + + :param status: The current status of the long running asynchronous shared private link resource + operation. Possible values include: "Running", "Succeeded", "Failed". + :type status: str or ~azure.mgmt.search.models.SharedPrivateLinkResourceAsyncOperationResult + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AsyncOperationResult, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + + +class CheckNameAvailabilityInput(msrest.serialization.Model): + """Input of check name availability API. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The search service name to validate. Search service names must only + contain lowercase letters, digits or dashes, cannot use dash as the first two or last one + characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in + length. + :type name: str + :ivar type: Required. The type of the resource whose name is to be validated. This value must + always be 'searchServices'. Default value: "searchServices". + :vartype type: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + type = "searchServices" + + def __init__( + self, + **kwargs + ): + super(CheckNameAvailabilityInput, self).__init__(**kwargs) + self.name = kwargs['name'] + + +class CheckNameAvailabilityOutput(msrest.serialization.Model): + """Output of check name availability API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar is_name_available: A value indicating whether the name is available. + :vartype is_name_available: bool + :ivar reason: The reason why the name is not available. 'Invalid' indicates the name provided + does not match the naming requirements (incorrect length, unsupported characters, etc.). + 'AlreadyExists' indicates that the name is already in use and is therefore unavailable. + Possible values include: "Invalid", "AlreadyExists". + :vartype reason: str or ~azure.mgmt.search.models.UnavailableNameReason + :ivar message: A message that explains why the name is invalid and provides resource naming + requirements. Available only if 'Invalid' is returned in the 'reason' property. + :vartype message: str + """ + + _validation = { + 'is_name_available': {'readonly': True}, + 'reason': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'is_name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckNameAvailabilityOutput, self).__init__(**kwargs) + self.is_name_available = None + self.reason = None + self.message = None + + +class CloudErrorBody(msrest.serialization.Model): + """Describes a particular API error with an error code and a message. + + :param code: An error code that describes the error condition more precisely than an HTTP + status code. Can be used to programmatically handle specific error cases. + :type code: str + :param message: A message that describes the error in detail and provides debugging + information. + :type message: str + :param target: The target of the particular error (for example, the name of the property in + error). + :type target: str + :param details: Contains nested errors that are related to this error. + :type details: list[~azure.mgmt.search.models.CloudErrorBody] + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudErrorBody, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.target = kwargs.get('target', None) + self.details = kwargs.get('details', None) + + +class Identity(msrest.serialization.Model): + """Identity for the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :param type: Required. The identity type. Possible values include: "None", "SystemAssigned". + :type type: str or ~azure.mgmt.search.models.IdentityType + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Identity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = kwargs['type'] + + +class IpRule(msrest.serialization.Model): + """The IP restriction rule of the Azure Cognitive Search service. + + :param value: Value corresponding to a single IPv4 address (eg., 123.1.2.3) or an IP range in + CIDR format (eg., 123.1.2.3/24) to be allowed. + :type value: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IpRule, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class ListQueryKeysResult(msrest.serialization.Model): + """Response containing the query API keys for a given Azure Cognitive Search service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The query keys for the Azure Cognitive Search service. + :vartype value: list[~azure.mgmt.search.models.QueryKey] + :ivar next_link: Request URL that can be used to query next page of query keys. Returned when + the total number of requested query keys exceed maximum page size. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[QueryKey]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ListQueryKeysResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class NetworkRuleSet(msrest.serialization.Model): + """Network specific rules that determine how the Azure Cognitive Search service may be reached. + + :param ip_rules: A list of IP restriction rules that defines the inbound network(s) with + allowing access to the search service endpoint. At the meantime, all other public IP networks + are blocked by the firewall. These restriction rules are applied only when the + 'publicNetworkAccess' of the search service is 'enabled'; otherwise, traffic over public + interface is not allowed even with any public IP rules, and private endpoint connections would + be the exclusive access method. + :type ip_rules: list[~azure.mgmt.search.models.IpRule] + """ + + _attribute_map = { + 'ip_rules': {'key': 'ipRules', 'type': '[IpRule]'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkRuleSet, self).__init__(**kwargs) + self.ip_rules = kwargs.get('ip_rules', None) + + +class Operation(msrest.serialization.Model): + """Describes a REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the operation. This name is of the form + {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The object that describes the operation. + :vartype display: ~azure.mgmt.search.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + 'display': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = None + + +class OperationDisplay(msrest.serialization.Model): + """The object that describes the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: The friendly name of the resource provider. + :vartype provider: str + :ivar operation: The operation type: read, write, delete, listKeys/action, etc. + :vartype operation: str + :ivar resource: The resource type on which the operation is performed. + :vartype resource: str + :ivar description: The friendly name of the operation. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'operation': {'readonly': True}, + 'resource': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.operation = None + self.resource = None + self.description = None + + +class OperationListResult(msrest.serialization.Model): + """The result of the request to list REST API operations. It contains a list of operations and a URL to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.search.models.Operation] + :ivar next_link: The URL to get the next set of operation list results, if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class Resource(msrest.serialization.Model): + """The resource model definition for a ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class PrivateEndpointConnection(Resource): + """Describes an existing Private Endpoint connection to the Azure Cognitive Search service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param properties: Describes the properties of an existing Private Endpoint connection to the + Azure Cognitive Search service. + :type properties: ~azure.mgmt.search.models.PrivateEndpointConnectionProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'PrivateEndpointConnectionProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class PrivateEndpointConnectionListResult(msrest.serialization.Model): + """Response containing a list of Private Endpoint connections. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of Private Endpoint connections. + :vartype value: list[~azure.mgmt.search.models.PrivateEndpointConnection] + :ivar next_link: Request URL that can be used to query next page of private endpoint + connections. Returned when the total number of requested private endpoint connections exceed + maximum page size. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class PrivateEndpointConnectionProperties(msrest.serialization.Model): + """Describes the properties of an existing Private Endpoint connection to the Azure Cognitive Search service. + + :param private_endpoint: The private endpoint resource from Microsoft.Network provider. + :type private_endpoint: + ~azure.mgmt.search.models.PrivateEndpointConnectionPropertiesPrivateEndpoint + :param private_link_service_connection_state: Describes the current state of an existing + Private Link Service connection to the Azure Private Endpoint. + :type private_link_service_connection_state: + ~azure.mgmt.search.models.PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState + """ + + _attribute_map = { + 'private_endpoint': {'key': 'privateEndpoint', 'type': 'PrivateEndpointConnectionPropertiesPrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'privateLinkServiceConnectionState', 'type': 'PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnectionProperties, self).__init__(**kwargs) + self.private_endpoint = kwargs.get('private_endpoint', None) + self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) + + +class PrivateEndpointConnectionPropertiesPrivateEndpoint(msrest.serialization.Model): + """The private endpoint resource from Microsoft.Network provider. + + :param id: The resource id of the private endpoint resource from Microsoft.Network provider. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnectionPropertiesPrivateEndpoint, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState(msrest.serialization.Model): + """Describes the current state of an existing Private Link Service connection to the Azure Private Endpoint. + + :param status: Status of the the private link service connection. Can be Pending, Approved, + Rejected, or Disconnected. Possible values include: "Pending", "Approved", "Rejected", + "Disconnected". + :type status: str or ~azure.mgmt.search.models.PrivateLinkServiceConnectionStatus + :param description: The description for the private link service connection state. + :type description: str + :param actions_required: A description of any extra actions that may be required. + :type actions_required: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.description = kwargs.get('description', None) + self.actions_required = kwargs.get('actions_required', "None") + + +class PrivateLinkResource(Resource): + """Describes a supported private link resource for the Azure Cognitive Search service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :ivar properties: Describes the properties of a supported private link resource for the Azure + Cognitive Search service. + :vartype properties: ~azure.mgmt.search.models.PrivateLinkResourceProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'properties': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'PrivateLinkResourceProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkResource, self).__init__(**kwargs) + self.properties = None + + +class PrivateLinkResourceProperties(msrest.serialization.Model): + """Describes the properties of a supported private link resource for the Azure Cognitive Search service. For a given API version, this represents the 'supported' groupIds when creating a shared private link resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar group_id: The group ID of the private link resource. + :vartype group_id: str + :ivar required_members: The list of required members of the private link resource. + :vartype required_members: list[str] + :ivar required_zone_names: The list of required DNS zone names of the private link resource. + :vartype required_zone_names: list[str] + :ivar shareable_private_link_resource_types: The list of resources that are onboarded to + private link service, that are supported by Azure Cognitive Search. + :vartype shareable_private_link_resource_types: + list[~azure.mgmt.search.models.ShareablePrivateLinkResourceType] + """ + + _validation = { + 'group_id': {'readonly': True}, + 'required_members': {'readonly': True}, + 'required_zone_names': {'readonly': True}, + 'shareable_private_link_resource_types': {'readonly': True}, + } + + _attribute_map = { + 'group_id': {'key': 'groupId', 'type': 'str'}, + 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'requiredZoneNames', 'type': '[str]'}, + 'shareable_private_link_resource_types': {'key': 'shareablePrivateLinkResourceTypes', 'type': '[ShareablePrivateLinkResourceType]'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkResourceProperties, self).__init__(**kwargs) + self.group_id = None + self.required_members = None + self.required_zone_names = None + self.shareable_private_link_resource_types = None + + +class PrivateLinkResourcesResult(msrest.serialization.Model): + """Response containing a list of supported Private Link Resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of supported Private Link Resources. + :vartype value: list[~azure.mgmt.search.models.PrivateLinkResource] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkResourcesResult, self).__init__(**kwargs) + self.value = None + + +class QueryKey(msrest.serialization.Model): + """Describes an API key for a given Azure Cognitive Search service that has permissions for query operations only. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the query API key; may be empty. + :vartype name: str + :ivar key: The value of the query API key. + :vartype key: str + """ + + _validation = { + 'name': {'readonly': True}, + 'key': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(QueryKey, self).__init__(**kwargs) + self.name = None + self.key = None + + +class SearchManagementRequestOptions(msrest.serialization.Model): + """Parameter group. + + :param client_request_id: A client-generated GUID value that identifies this request. If + specified, this will be included in response information as a way to track the request. + :type client_request_id: str + """ + + _attribute_map = { + 'client_request_id': {'key': 'clientRequestId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchManagementRequestOptions, self).__init__(**kwargs) + self.client_request_id = kwargs.get('client_request_id', None) + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.location = kwargs['location'] + + +class SearchService(TrackedResource): + """Describes an Azure Cognitive Search service and its current state. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :param sku: The SKU of the Search Service, which determines price tier and capacity limits. + This property is required when creating a new Search Service. + :type sku: ~azure.mgmt.search.models.Sku + :param identity: The identity of the resource. + :type identity: ~azure.mgmt.search.models.Identity + :param replica_count: The number of replicas in the search service. If specified, it must be a + value between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU. + :type replica_count: int + :param partition_count: The number of partitions in the search service; if specified, it can be + 1, 2, 3, 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' + services with hostingMode set to 'highDensity', the allowed values are between 1 and 3. + :type partition_count: int + :param hosting_mode: Applicable only for the standard3 SKU. You can set this property to enable + up to 3 high density partitions that allow up to 1000 indexes, which is much higher than the + maximum indexes allowed for any other SKU. For the standard3 SKU, the value is either 'default' + or 'highDensity'. For all other SKUs, this value must be 'default'. Possible values include: + "default", "highDensity". Default value: "default". + :type hosting_mode: str or ~azure.mgmt.search.models.HostingMode + :param public_network_access: This value can be set to 'enabled' to avoid breaking changes on + existing customer resources and templates. If set to 'disabled', traffic over public interface + is not allowed, and private endpoint connections would be the exclusive access method. Possible + values include: "enabled", "disabled". Default value: "enabled". + :type public_network_access: str or ~azure.mgmt.search.models.PublicNetworkAccess + :ivar status: The status of the search service. Possible values include: 'running': The search + service is running and no provisioning operations are underway. 'provisioning': The search + service is being provisioned or scaled up or down. 'deleting': The search service is being + deleted. 'degraded': The search service is degraded. This can occur when the underlying search + units are not healthy. The search service is most likely operational, but performance might be + slow and some requests might be dropped. 'disabled': The search service is disabled. In this + state, the service will reject all API requests. 'error': The search service is in an error + state. If your service is in the degraded, disabled, or error states, it means the Azure + Cognitive Search team is actively investigating the underlying issue. Dedicated services in + these states are still chargeable based on the number of search units provisioned. Possible + values include: "running", "provisioning", "deleting", "degraded", "disabled", "error". + :vartype status: str or ~azure.mgmt.search.models.SearchServiceStatus + :ivar status_details: The details of the search service status. + :vartype status_details: str + :ivar provisioning_state: The state of the last provisioning operation performed on the search + service. Provisioning is an intermediate state that occurs while service capacity is being + established. After capacity is set up, provisioningState changes to either 'succeeded' or + 'failed'. Client applications can poll provisioning status (the recommended polling interval is + from 30 seconds to one minute) by using the Get Search Service operation to see when an + operation is completed. If you are using the free service, this value tends to come back as + 'succeeded' directly in the call to Create search service. This is because the free service + uses capacity that is already set up. Possible values include: "succeeded", "provisioning", + "failed". + :vartype provisioning_state: str or ~azure.mgmt.search.models.ProvisioningState + :param network_rule_set: Network specific rules that determine how the Azure Cognitive Search + service may be reached. + :type network_rule_set: ~azure.mgmt.search.models.NetworkRuleSet + :ivar private_endpoint_connections: The list of private endpoint connections to the Azure + Cognitive Search service. + :vartype private_endpoint_connections: + list[~azure.mgmt.search.models.PrivateEndpointConnection] + :ivar shared_private_link_resources: The list of shared private link resources managed by the + Azure Cognitive Search service. + :vartype shared_private_link_resources: + list[~azure.mgmt.search.models.SharedPrivateLinkResource] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'replica_count': {'maximum': 12, 'minimum': 1}, + 'partition_count': {'maximum': 12, 'minimum': 1}, + 'status': {'readonly': True}, + 'status_details': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, + 'shared_private_link_resources': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + 'replica_count': {'key': 'properties.replicaCount', 'type': 'int'}, + 'partition_count': {'key': 'properties.partitionCount', 'type': 'int'}, + 'hosting_mode': {'key': 'properties.hostingMode', 'type': 'str'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'status_details': {'key': 'properties.statusDetails', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'network_rule_set': {'key': 'properties.networkRuleSet', 'type': 'NetworkRuleSet'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'shared_private_link_resources': {'key': 'properties.sharedPrivateLinkResources', 'type': '[SharedPrivateLinkResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchService, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) + self.identity = kwargs.get('identity', None) + self.replica_count = kwargs.get('replica_count', 1) + self.partition_count = kwargs.get('partition_count', 1) + self.hosting_mode = kwargs.get('hosting_mode', "default") + self.public_network_access = kwargs.get('public_network_access', "enabled") + self.status = None + self.status_details = None + self.provisioning_state = None + self.network_rule_set = kwargs.get('network_rule_set', None) + self.private_endpoint_connections = None + self.shared_private_link_resources = None + + +class SearchServiceListResult(msrest.serialization.Model): + """Response containing a list of Azure Cognitive Search services. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of search services. + :vartype value: list[~azure.mgmt.search.models.SearchService] + :ivar next_link: Request URL that can be used to query next page of search services. Returned + when the total number of requested search services exceed maximum page size. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SearchService]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchServiceListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class SearchServiceUpdate(Resource): + """The parameters used to update an Azure Cognitive Search service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param sku: The SKU of the Search Service, which determines price tier and capacity limits. + This property is required when creating a new Search Service. + :type sku: ~azure.mgmt.search.models.Sku + :param location: The geographic location of the resource. This must be one of the supported and + registered Azure Geo Regions (for example, West US, East US, Southeast Asia, and so forth). + This property is required when creating a new resource. + :type location: str + :param tags: A set of tags. Tags to help categorize the resource in the Azure portal. + :type tags: dict[str, str] + :param identity: The identity of the resource. + :type identity: ~azure.mgmt.search.models.Identity + :param replica_count: The number of replicas in the search service. If specified, it must be a + value between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU. + :type replica_count: int + :param partition_count: The number of partitions in the search service; if specified, it can be + 1, 2, 3, 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' + services with hostingMode set to 'highDensity', the allowed values are between 1 and 3. + :type partition_count: int + :param hosting_mode: Applicable only for the standard3 SKU. You can set this property to enable + up to 3 high density partitions that allow up to 1000 indexes, which is much higher than the + maximum indexes allowed for any other SKU. For the standard3 SKU, the value is either 'default' + or 'highDensity'. For all other SKUs, this value must be 'default'. Possible values include: + "default", "highDensity". Default value: "default". + :type hosting_mode: str or ~azure.mgmt.search.models.HostingMode + :param public_network_access: This value can be set to 'enabled' to avoid breaking changes on + existing customer resources and templates. If set to 'disabled', traffic over public interface + is not allowed, and private endpoint connections would be the exclusive access method. Possible + values include: "enabled", "disabled". Default value: "enabled". + :type public_network_access: str or ~azure.mgmt.search.models.PublicNetworkAccess + :ivar status: The status of the search service. Possible values include: 'running': The search + service is running and no provisioning operations are underway. 'provisioning': The search + service is being provisioned or scaled up or down. 'deleting': The search service is being + deleted. 'degraded': The search service is degraded. This can occur when the underlying search + units are not healthy. The search service is most likely operational, but performance might be + slow and some requests might be dropped. 'disabled': The search service is disabled. In this + state, the service will reject all API requests. 'error': The search service is in an error + state. If your service is in the degraded, disabled, or error states, it means the Azure + Cognitive Search team is actively investigating the underlying issue. Dedicated services in + these states are still chargeable based on the number of search units provisioned. Possible + values include: "running", "provisioning", "deleting", "degraded", "disabled", "error". + :vartype status: str or ~azure.mgmt.search.models.SearchServiceStatus + :ivar status_details: The details of the search service status. + :vartype status_details: str + :ivar provisioning_state: The state of the last provisioning operation performed on the search + service. Provisioning is an intermediate state that occurs while service capacity is being + established. After capacity is set up, provisioningState changes to either 'succeeded' or + 'failed'. Client applications can poll provisioning status (the recommended polling interval is + from 30 seconds to one minute) by using the Get Search Service operation to see when an + operation is completed. If you are using the free service, this value tends to come back as + 'succeeded' directly in the call to Create search service. This is because the free service + uses capacity that is already set up. Possible values include: "succeeded", "provisioning", + "failed". + :vartype provisioning_state: str or ~azure.mgmt.search.models.ProvisioningState + :param network_rule_set: Network specific rules that determine how the Azure Cognitive Search + service may be reached. + :type network_rule_set: ~azure.mgmt.search.models.NetworkRuleSet + :ivar private_endpoint_connections: The list of private endpoint connections to the Azure + Cognitive Search service. + :vartype private_endpoint_connections: + list[~azure.mgmt.search.models.PrivateEndpointConnection] + :ivar shared_private_link_resources: The list of shared private link resources managed by the + Azure Cognitive Search service. + :vartype shared_private_link_resources: + list[~azure.mgmt.search.models.SharedPrivateLinkResource] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'replica_count': {'maximum': 12, 'minimum': 1}, + 'partition_count': {'maximum': 12, 'minimum': 1}, + 'status': {'readonly': True}, + 'status_details': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, + 'shared_private_link_resources': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + 'replica_count': {'key': 'properties.replicaCount', 'type': 'int'}, + 'partition_count': {'key': 'properties.partitionCount', 'type': 'int'}, + 'hosting_mode': {'key': 'properties.hostingMode', 'type': 'str'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'status_details': {'key': 'properties.statusDetails', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'network_rule_set': {'key': 'properties.networkRuleSet', 'type': 'NetworkRuleSet'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'shared_private_link_resources': {'key': 'properties.sharedPrivateLinkResources', 'type': '[SharedPrivateLinkResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchServiceUpdate, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + self.identity = kwargs.get('identity', None) + self.replica_count = kwargs.get('replica_count', 1) + self.partition_count = kwargs.get('partition_count', 1) + self.hosting_mode = kwargs.get('hosting_mode', "default") + self.public_network_access = kwargs.get('public_network_access', "enabled") + self.status = None + self.status_details = None + self.provisioning_state = None + self.network_rule_set = kwargs.get('network_rule_set', None) + self.private_endpoint_connections = None + self.shared_private_link_resources = None + + +class ShareablePrivateLinkResourceProperties(msrest.serialization.Model): + """Describes the properties of a resource type that has been onboarded to private link service, supported by Azure Cognitive Search. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The resource provider type for the resource that has been onboarded to private link + service, supported by Azure Cognitive Search. + :vartype type: str + :ivar group_id: The resource provider group id for the resource that has been onboarded to + private link service, supported by Azure Cognitive Search. + :vartype group_id: str + :ivar description: The description of the resource type that has been onboarded to private link + service, supported by Azure Cognitive Search. + :vartype description: str + """ + + _validation = { + 'type': {'readonly': True}, + 'group_id': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'group_id': {'key': 'groupId', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ShareablePrivateLinkResourceProperties, self).__init__(**kwargs) + self.type = None + self.group_id = None + self.description = None + + +class ShareablePrivateLinkResourceType(msrest.serialization.Model): + """Describes an resource type that has been onboarded to private link service, supported by Azure Cognitive Search. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the resource type that has been onboarded to private link service, + supported by Azure Cognitive Search. + :vartype name: str + :ivar properties: Describes the properties of a resource type that has been onboarded to + private link service, supported by Azure Cognitive Search. + :vartype properties: ~azure.mgmt.search.models.ShareablePrivateLinkResourceProperties + """ + + _validation = { + 'name': {'readonly': True}, + 'properties': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ShareablePrivateLinkResourceProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(ShareablePrivateLinkResourceType, self).__init__(**kwargs) + self.name = None + self.properties = None + + +class SharedPrivateLinkResource(Resource): + """Describes a Shared Private Link Resource managed by the Azure Cognitive Search service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param properties: Describes the properties of a Shared Private Link Resource managed by the + Azure Cognitive Search service. + :type properties: ~azure.mgmt.search.models.SharedPrivateLinkResourceProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'SharedPrivateLinkResourceProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(SharedPrivateLinkResource, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class SharedPrivateLinkResourceListResult(msrest.serialization.Model): + """Response containing a list of Shared Private Link Resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of Shared Private Link Resources. + :vartype value: list[~azure.mgmt.search.models.SharedPrivateLinkResource] + :param next_link: The URL to get the next set of shared private link resources, if there are + any. + :type next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SharedPrivateLinkResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SharedPrivateLinkResourceListResult, self).__init__(**kwargs) + self.value = None + self.next_link = kwargs.get('next_link', None) + + +class SharedPrivateLinkResourceProperties(msrest.serialization.Model): + """Describes the properties of an existing Shared Private Link Resource managed by the Azure Cognitive Search service. + + :param private_link_resource_id: The resource id of the resource the shared private link + resource is for. + :type private_link_resource_id: str + :param group_id: The group id from the provider of resource the shared private link resource is + for. + :type group_id: str + :param request_message: The request message for requesting approval of the shared private link + resource. + :type request_message: str + :param resource_region: Optional. Can be used to specify the Azure Resource Manager location of + the resource to which a shared private link is to be created. This is only required for those + resources whose DNS configuration are regional (such as Azure Kubernetes Service). + :type resource_region: str + :param status: Status of the shared private link resource. Can be Pending, Approved, Rejected + or Disconnected. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + :type status: str or ~azure.mgmt.search.models.SharedPrivateLinkResourceStatus + :param provisioning_state: The provisioning state of the shared private link resource. Can be + Updating, Deleting, Failed, Succeeded or Incomplete. Possible values include: "Updating", + "Deleting", "Failed", "Succeeded", "Incomplete". + :type provisioning_state: str or + ~azure.mgmt.search.models.SharedPrivateLinkResourceProvisioningState + """ + + _attribute_map = { + 'private_link_resource_id': {'key': 'privateLinkResourceId', 'type': 'str'}, + 'group_id': {'key': 'groupId', 'type': 'str'}, + 'request_message': {'key': 'requestMessage', 'type': 'str'}, + 'resource_region': {'key': 'resourceRegion', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SharedPrivateLinkResourceProperties, self).__init__(**kwargs) + self.private_link_resource_id = kwargs.get('private_link_resource_id', None) + self.group_id = kwargs.get('group_id', None) + self.request_message = kwargs.get('request_message', None) + self.resource_region = kwargs.get('resource_region', None) + self.status = kwargs.get('status', None) + self.provisioning_state = kwargs.get('provisioning_state', None) + + +class Sku(msrest.serialization.Model): + """Defines the SKU of an Azure Cognitive Search Service, which determines price tier and capacity limits. + + :param name: The SKU of the search service. Valid values include: 'free': Shared service. + 'basic': Dedicated service with up to 3 replicas. 'standard': Dedicated service with up to 12 + partitions and 12 replicas. 'standard2': Similar to standard, but with more capacity per search + unit. 'standard3': The largest Standard offering with up to 12 partitions and 12 replicas (or + up to 3 partitions with more indexes if you also set the hostingMode property to + 'highDensity'). 'storage_optimized_l1': Supports 1TB per partition, up to 12 partitions. + 'storage_optimized_l2': Supports 2TB per partition, up to 12 partitions.'. Possible values + include: "free", "basic", "standard", "standard2", "standard3", "storage_optimized_l1", + "storage_optimized_l2". + :type name: str or ~azure.mgmt.search.models.SkuName + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = kwargs.get('name', None) diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_models_py3.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_models_py3.py new file mode 100644 index 000000000000..d752b1bb9ae7 --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_models_py3.py @@ -0,0 +1,1344 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Dict, List, Optional, Union + +import msrest.serialization + +from ._search_management_client_enums import * + + +class AdminKeyResult(msrest.serialization.Model): + """Response containing the primary and secondary admin API keys for a given Azure Cognitive Search service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar primary_key: The primary admin API key of the search service. + :vartype primary_key: str + :ivar secondary_key: The secondary admin API key of the search service. + :vartype secondary_key: str + """ + + _validation = { + 'primary_key': {'readonly': True}, + 'secondary_key': {'readonly': True}, + } + + _attribute_map = { + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AdminKeyResult, self).__init__(**kwargs) + self.primary_key = None + self.secondary_key = None + + +class AsyncOperationResult(msrest.serialization.Model): + """The details of a long running asynchronous shared private link resource operation. + + :param status: The current status of the long running asynchronous shared private link resource + operation. Possible values include: "Running", "Succeeded", "Failed". + :type status: str or ~azure.mgmt.search.models.SharedPrivateLinkResourceAsyncOperationResult + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "SharedPrivateLinkResourceAsyncOperationResult"]] = None, + **kwargs + ): + super(AsyncOperationResult, self).__init__(**kwargs) + self.status = status + + +class CheckNameAvailabilityInput(msrest.serialization.Model): + """Input of check name availability API. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The search service name to validate. Search service names must only + contain lowercase letters, digits or dashes, cannot use dash as the first two or last one + characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in + length. + :type name: str + :ivar type: Required. The type of the resource whose name is to be validated. This value must + always be 'searchServices'. Default value: "searchServices". + :vartype type: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + type = "searchServices" + + def __init__( + self, + *, + name: str, + **kwargs + ): + super(CheckNameAvailabilityInput, self).__init__(**kwargs) + self.name = name + + +class CheckNameAvailabilityOutput(msrest.serialization.Model): + """Output of check name availability API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar is_name_available: A value indicating whether the name is available. + :vartype is_name_available: bool + :ivar reason: The reason why the name is not available. 'Invalid' indicates the name provided + does not match the naming requirements (incorrect length, unsupported characters, etc.). + 'AlreadyExists' indicates that the name is already in use and is therefore unavailable. + Possible values include: "Invalid", "AlreadyExists". + :vartype reason: str or ~azure.mgmt.search.models.UnavailableNameReason + :ivar message: A message that explains why the name is invalid and provides resource naming + requirements. Available only if 'Invalid' is returned in the 'reason' property. + :vartype message: str + """ + + _validation = { + 'is_name_available': {'readonly': True}, + 'reason': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'is_name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckNameAvailabilityOutput, self).__init__(**kwargs) + self.is_name_available = None + self.reason = None + self.message = None + + +class CloudErrorBody(msrest.serialization.Model): + """Describes a particular API error with an error code and a message. + + :param code: An error code that describes the error condition more precisely than an HTTP + status code. Can be used to programmatically handle specific error cases. + :type code: str + :param message: A message that describes the error in detail and provides debugging + information. + :type message: str + :param target: The target of the particular error (for example, the name of the property in + error). + :type target: str + :param details: Contains nested errors that are related to this error. + :type details: list[~azure.mgmt.search.models.CloudErrorBody] + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["CloudErrorBody"]] = None, + **kwargs + ): + super(CloudErrorBody, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +class Identity(msrest.serialization.Model): + """Identity for the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :param type: Required. The identity type. Possible values include: "None", "SystemAssigned". + :type type: str or ~azure.mgmt.search.models.IdentityType + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Union[str, "IdentityType"], + **kwargs + ): + super(Identity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + + +class IpRule(msrest.serialization.Model): + """The IP restriction rule of the Azure Cognitive Search service. + + :param value: Value corresponding to a single IPv4 address (eg., 123.1.2.3) or an IP range in + CIDR format (eg., 123.1.2.3/24) to be allowed. + :type value: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[str] = None, + **kwargs + ): + super(IpRule, self).__init__(**kwargs) + self.value = value + + +class ListQueryKeysResult(msrest.serialization.Model): + """Response containing the query API keys for a given Azure Cognitive Search service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The query keys for the Azure Cognitive Search service. + :vartype value: list[~azure.mgmt.search.models.QueryKey] + :ivar next_link: Request URL that can be used to query next page of query keys. Returned when + the total number of requested query keys exceed maximum page size. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[QueryKey]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ListQueryKeysResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class NetworkRuleSet(msrest.serialization.Model): + """Network specific rules that determine how the Azure Cognitive Search service may be reached. + + :param ip_rules: A list of IP restriction rules that defines the inbound network(s) with + allowing access to the search service endpoint. At the meantime, all other public IP networks + are blocked by the firewall. These restriction rules are applied only when the + 'publicNetworkAccess' of the search service is 'enabled'; otherwise, traffic over public + interface is not allowed even with any public IP rules, and private endpoint connections would + be the exclusive access method. + :type ip_rules: list[~azure.mgmt.search.models.IpRule] + """ + + _attribute_map = { + 'ip_rules': {'key': 'ipRules', 'type': '[IpRule]'}, + } + + def __init__( + self, + *, + ip_rules: Optional[List["IpRule"]] = None, + **kwargs + ): + super(NetworkRuleSet, self).__init__(**kwargs) + self.ip_rules = ip_rules + + +class Operation(msrest.serialization.Model): + """Describes a REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the operation. This name is of the form + {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The object that describes the operation. + :vartype display: ~azure.mgmt.search.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + 'display': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = None + + +class OperationDisplay(msrest.serialization.Model): + """The object that describes the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: The friendly name of the resource provider. + :vartype provider: str + :ivar operation: The operation type: read, write, delete, listKeys/action, etc. + :vartype operation: str + :ivar resource: The resource type on which the operation is performed. + :vartype resource: str + :ivar description: The friendly name of the operation. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'operation': {'readonly': True}, + 'resource': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.operation = None + self.resource = None + self.description = None + + +class OperationListResult(msrest.serialization.Model): + """The result of the request to list REST API operations. It contains a list of operations and a URL to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.search.models.Operation] + :ivar next_link: The URL to get the next set of operation list results, if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class Resource(msrest.serialization.Model): + """The resource model definition for a ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class PrivateEndpointConnection(Resource): + """Describes an existing Private Endpoint connection to the Azure Cognitive Search service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param properties: Describes the properties of an existing Private Endpoint connection to the + Azure Cognitive Search service. + :type properties: ~azure.mgmt.search.models.PrivateEndpointConnectionProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'PrivateEndpointConnectionProperties'}, + } + + def __init__( + self, + *, + properties: Optional["PrivateEndpointConnectionProperties"] = None, + **kwargs + ): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.properties = properties + + +class PrivateEndpointConnectionListResult(msrest.serialization.Model): + """Response containing a list of Private Endpoint connections. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of Private Endpoint connections. + :vartype value: list[~azure.mgmt.search.models.PrivateEndpointConnection] + :ivar next_link: Request URL that can be used to query next page of private endpoint + connections. Returned when the total number of requested private endpoint connections exceed + maximum page size. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class PrivateEndpointConnectionProperties(msrest.serialization.Model): + """Describes the properties of an existing Private Endpoint connection to the Azure Cognitive Search service. + + :param private_endpoint: The private endpoint resource from Microsoft.Network provider. + :type private_endpoint: + ~azure.mgmt.search.models.PrivateEndpointConnectionPropertiesPrivateEndpoint + :param private_link_service_connection_state: Describes the current state of an existing + Private Link Service connection to the Azure Private Endpoint. + :type private_link_service_connection_state: + ~azure.mgmt.search.models.PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState + """ + + _attribute_map = { + 'private_endpoint': {'key': 'privateEndpoint', 'type': 'PrivateEndpointConnectionPropertiesPrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'privateLinkServiceConnectionState', 'type': 'PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState'}, + } + + def __init__( + self, + *, + private_endpoint: Optional["PrivateEndpointConnectionPropertiesPrivateEndpoint"] = None, + private_link_service_connection_state: Optional["PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState"] = None, + **kwargs + ): + super(PrivateEndpointConnectionProperties, self).__init__(**kwargs) + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + + +class PrivateEndpointConnectionPropertiesPrivateEndpoint(msrest.serialization.Model): + """The private endpoint resource from Microsoft.Network provider. + + :param id: The resource id of the private endpoint resource from Microsoft.Network provider. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + super(PrivateEndpointConnectionPropertiesPrivateEndpoint, self).__init__(**kwargs) + self.id = id + + +class PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState(msrest.serialization.Model): + """Describes the current state of an existing Private Link Service connection to the Azure Private Endpoint. + + :param status: Status of the the private link service connection. Can be Pending, Approved, + Rejected, or Disconnected. Possible values include: "Pending", "Approved", "Rejected", + "Disconnected". + :type status: str or ~azure.mgmt.search.models.PrivateLinkServiceConnectionStatus + :param description: The description for the private link service connection state. + :type description: str + :param actions_required: A description of any extra actions that may be required. + :type actions_required: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "PrivateLinkServiceConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[str] = "None", + **kwargs + ): + super(PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = status + self.description = description + self.actions_required = actions_required + + +class PrivateLinkResource(Resource): + """Describes a supported private link resource for the Azure Cognitive Search service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :ivar properties: Describes the properties of a supported private link resource for the Azure + Cognitive Search service. + :vartype properties: ~azure.mgmt.search.models.PrivateLinkResourceProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'properties': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'PrivateLinkResourceProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkResource, self).__init__(**kwargs) + self.properties = None + + +class PrivateLinkResourceProperties(msrest.serialization.Model): + """Describes the properties of a supported private link resource for the Azure Cognitive Search service. For a given API version, this represents the 'supported' groupIds when creating a shared private link resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar group_id: The group ID of the private link resource. + :vartype group_id: str + :ivar required_members: The list of required members of the private link resource. + :vartype required_members: list[str] + :ivar required_zone_names: The list of required DNS zone names of the private link resource. + :vartype required_zone_names: list[str] + :ivar shareable_private_link_resource_types: The list of resources that are onboarded to + private link service, that are supported by Azure Cognitive Search. + :vartype shareable_private_link_resource_types: + list[~azure.mgmt.search.models.ShareablePrivateLinkResourceType] + """ + + _validation = { + 'group_id': {'readonly': True}, + 'required_members': {'readonly': True}, + 'required_zone_names': {'readonly': True}, + 'shareable_private_link_resource_types': {'readonly': True}, + } + + _attribute_map = { + 'group_id': {'key': 'groupId', 'type': 'str'}, + 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'requiredZoneNames', 'type': '[str]'}, + 'shareable_private_link_resource_types': {'key': 'shareablePrivateLinkResourceTypes', 'type': '[ShareablePrivateLinkResourceType]'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkResourceProperties, self).__init__(**kwargs) + self.group_id = None + self.required_members = None + self.required_zone_names = None + self.shareable_private_link_resource_types = None + + +class PrivateLinkResourcesResult(msrest.serialization.Model): + """Response containing a list of supported Private Link Resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of supported Private Link Resources. + :vartype value: list[~azure.mgmt.search.models.PrivateLinkResource] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkResourcesResult, self).__init__(**kwargs) + self.value = None + + +class QueryKey(msrest.serialization.Model): + """Describes an API key for a given Azure Cognitive Search service that has permissions for query operations only. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the query API key; may be empty. + :vartype name: str + :ivar key: The value of the query API key. + :vartype key: str + """ + + _validation = { + 'name': {'readonly': True}, + 'key': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(QueryKey, self).__init__(**kwargs) + self.name = None + self.key = None + + +class SearchManagementRequestOptions(msrest.serialization.Model): + """Parameter group. + + :param client_request_id: A client-generated GUID value that identifies this request. If + specified, this will be included in response information as a way to track the request. + :type client_request_id: str + """ + + _attribute_map = { + 'client_request_id': {'key': 'clientRequestId', 'type': 'str'}, + } + + def __init__( + self, + *, + client_request_id: Optional[str] = None, + **kwargs + ): + super(SearchManagementRequestOptions, self).__init__(**kwargs) + self.client_request_id = client_request_id + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = tags + self.location = location + + +class SearchService(TrackedResource): + """Describes an Azure Cognitive Search service and its current state. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :param sku: The SKU of the Search Service, which determines price tier and capacity limits. + This property is required when creating a new Search Service. + :type sku: ~azure.mgmt.search.models.Sku + :param identity: The identity of the resource. + :type identity: ~azure.mgmt.search.models.Identity + :param replica_count: The number of replicas in the search service. If specified, it must be a + value between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU. + :type replica_count: int + :param partition_count: The number of partitions in the search service; if specified, it can be + 1, 2, 3, 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' + services with hostingMode set to 'highDensity', the allowed values are between 1 and 3. + :type partition_count: int + :param hosting_mode: Applicable only for the standard3 SKU. You can set this property to enable + up to 3 high density partitions that allow up to 1000 indexes, which is much higher than the + maximum indexes allowed for any other SKU. For the standard3 SKU, the value is either 'default' + or 'highDensity'. For all other SKUs, this value must be 'default'. Possible values include: + "default", "highDensity". Default value: "default". + :type hosting_mode: str or ~azure.mgmt.search.models.HostingMode + :param public_network_access: This value can be set to 'enabled' to avoid breaking changes on + existing customer resources and templates. If set to 'disabled', traffic over public interface + is not allowed, and private endpoint connections would be the exclusive access method. Possible + values include: "enabled", "disabled". Default value: "enabled". + :type public_network_access: str or ~azure.mgmt.search.models.PublicNetworkAccess + :ivar status: The status of the search service. Possible values include: 'running': The search + service is running and no provisioning operations are underway. 'provisioning': The search + service is being provisioned or scaled up or down. 'deleting': The search service is being + deleted. 'degraded': The search service is degraded. This can occur when the underlying search + units are not healthy. The search service is most likely operational, but performance might be + slow and some requests might be dropped. 'disabled': The search service is disabled. In this + state, the service will reject all API requests. 'error': The search service is in an error + state. If your service is in the degraded, disabled, or error states, it means the Azure + Cognitive Search team is actively investigating the underlying issue. Dedicated services in + these states are still chargeable based on the number of search units provisioned. Possible + values include: "running", "provisioning", "deleting", "degraded", "disabled", "error". + :vartype status: str or ~azure.mgmt.search.models.SearchServiceStatus + :ivar status_details: The details of the search service status. + :vartype status_details: str + :ivar provisioning_state: The state of the last provisioning operation performed on the search + service. Provisioning is an intermediate state that occurs while service capacity is being + established. After capacity is set up, provisioningState changes to either 'succeeded' or + 'failed'. Client applications can poll provisioning status (the recommended polling interval is + from 30 seconds to one minute) by using the Get Search Service operation to see when an + operation is completed. If you are using the free service, this value tends to come back as + 'succeeded' directly in the call to Create search service. This is because the free service + uses capacity that is already set up. Possible values include: "succeeded", "provisioning", + "failed". + :vartype provisioning_state: str or ~azure.mgmt.search.models.ProvisioningState + :param network_rule_set: Network specific rules that determine how the Azure Cognitive Search + service may be reached. + :type network_rule_set: ~azure.mgmt.search.models.NetworkRuleSet + :ivar private_endpoint_connections: The list of private endpoint connections to the Azure + Cognitive Search service. + :vartype private_endpoint_connections: + list[~azure.mgmt.search.models.PrivateEndpointConnection] + :ivar shared_private_link_resources: The list of shared private link resources managed by the + Azure Cognitive Search service. + :vartype shared_private_link_resources: + list[~azure.mgmt.search.models.SharedPrivateLinkResource] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'replica_count': {'maximum': 12, 'minimum': 1}, + 'partition_count': {'maximum': 12, 'minimum': 1}, + 'status': {'readonly': True}, + 'status_details': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, + 'shared_private_link_resources': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + 'replica_count': {'key': 'properties.replicaCount', 'type': 'int'}, + 'partition_count': {'key': 'properties.partitionCount', 'type': 'int'}, + 'hosting_mode': {'key': 'properties.hostingMode', 'type': 'str'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'status_details': {'key': 'properties.statusDetails', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'network_rule_set': {'key': 'properties.networkRuleSet', 'type': 'NetworkRuleSet'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'shared_private_link_resources': {'key': 'properties.sharedPrivateLinkResources', 'type': '[SharedPrivateLinkResource]'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + sku: Optional["Sku"] = None, + identity: Optional["Identity"] = None, + replica_count: Optional[int] = 1, + partition_count: Optional[int] = 1, + hosting_mode: Optional[Union[str, "HostingMode"]] = "default", + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = "enabled", + network_rule_set: Optional["NetworkRuleSet"] = None, + **kwargs + ): + super(SearchService, self).__init__(tags=tags, location=location, **kwargs) + self.sku = sku + self.identity = identity + self.replica_count = replica_count + self.partition_count = partition_count + self.hosting_mode = hosting_mode + self.public_network_access = public_network_access + self.status = None + self.status_details = None + self.provisioning_state = None + self.network_rule_set = network_rule_set + self.private_endpoint_connections = None + self.shared_private_link_resources = None + + +class SearchServiceListResult(msrest.serialization.Model): + """Response containing a list of Azure Cognitive Search services. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of search services. + :vartype value: list[~azure.mgmt.search.models.SearchService] + :ivar next_link: Request URL that can be used to query next page of search services. Returned + when the total number of requested search services exceed maximum page size. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SearchService]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchServiceListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class SearchServiceUpdate(Resource): + """The parameters used to update an Azure Cognitive Search service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param sku: The SKU of the Search Service, which determines price tier and capacity limits. + This property is required when creating a new Search Service. + :type sku: ~azure.mgmt.search.models.Sku + :param location: The geographic location of the resource. This must be one of the supported and + registered Azure Geo Regions (for example, West US, East US, Southeast Asia, and so forth). + This property is required when creating a new resource. + :type location: str + :param tags: A set of tags. Tags to help categorize the resource in the Azure portal. + :type tags: dict[str, str] + :param identity: The identity of the resource. + :type identity: ~azure.mgmt.search.models.Identity + :param replica_count: The number of replicas in the search service. If specified, it must be a + value between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU. + :type replica_count: int + :param partition_count: The number of partitions in the search service; if specified, it can be + 1, 2, 3, 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' + services with hostingMode set to 'highDensity', the allowed values are between 1 and 3. + :type partition_count: int + :param hosting_mode: Applicable only for the standard3 SKU. You can set this property to enable + up to 3 high density partitions that allow up to 1000 indexes, which is much higher than the + maximum indexes allowed for any other SKU. For the standard3 SKU, the value is either 'default' + or 'highDensity'. For all other SKUs, this value must be 'default'. Possible values include: + "default", "highDensity". Default value: "default". + :type hosting_mode: str or ~azure.mgmt.search.models.HostingMode + :param public_network_access: This value can be set to 'enabled' to avoid breaking changes on + existing customer resources and templates. If set to 'disabled', traffic over public interface + is not allowed, and private endpoint connections would be the exclusive access method. Possible + values include: "enabled", "disabled". Default value: "enabled". + :type public_network_access: str or ~azure.mgmt.search.models.PublicNetworkAccess + :ivar status: The status of the search service. Possible values include: 'running': The search + service is running and no provisioning operations are underway. 'provisioning': The search + service is being provisioned or scaled up or down. 'deleting': The search service is being + deleted. 'degraded': The search service is degraded. This can occur when the underlying search + units are not healthy. The search service is most likely operational, but performance might be + slow and some requests might be dropped. 'disabled': The search service is disabled. In this + state, the service will reject all API requests. 'error': The search service is in an error + state. If your service is in the degraded, disabled, or error states, it means the Azure + Cognitive Search team is actively investigating the underlying issue. Dedicated services in + these states are still chargeable based on the number of search units provisioned. Possible + values include: "running", "provisioning", "deleting", "degraded", "disabled", "error". + :vartype status: str or ~azure.mgmt.search.models.SearchServiceStatus + :ivar status_details: The details of the search service status. + :vartype status_details: str + :ivar provisioning_state: The state of the last provisioning operation performed on the search + service. Provisioning is an intermediate state that occurs while service capacity is being + established. After capacity is set up, provisioningState changes to either 'succeeded' or + 'failed'. Client applications can poll provisioning status (the recommended polling interval is + from 30 seconds to one minute) by using the Get Search Service operation to see when an + operation is completed. If you are using the free service, this value tends to come back as + 'succeeded' directly in the call to Create search service. This is because the free service + uses capacity that is already set up. Possible values include: "succeeded", "provisioning", + "failed". + :vartype provisioning_state: str or ~azure.mgmt.search.models.ProvisioningState + :param network_rule_set: Network specific rules that determine how the Azure Cognitive Search + service may be reached. + :type network_rule_set: ~azure.mgmt.search.models.NetworkRuleSet + :ivar private_endpoint_connections: The list of private endpoint connections to the Azure + Cognitive Search service. + :vartype private_endpoint_connections: + list[~azure.mgmt.search.models.PrivateEndpointConnection] + :ivar shared_private_link_resources: The list of shared private link resources managed by the + Azure Cognitive Search service. + :vartype shared_private_link_resources: + list[~azure.mgmt.search.models.SharedPrivateLinkResource] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'replica_count': {'maximum': 12, 'minimum': 1}, + 'partition_count': {'maximum': 12, 'minimum': 1}, + 'status': {'readonly': True}, + 'status_details': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, + 'shared_private_link_resources': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + 'replica_count': {'key': 'properties.replicaCount', 'type': 'int'}, + 'partition_count': {'key': 'properties.partitionCount', 'type': 'int'}, + 'hosting_mode': {'key': 'properties.hostingMode', 'type': 'str'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'status_details': {'key': 'properties.statusDetails', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'network_rule_set': {'key': 'properties.networkRuleSet', 'type': 'NetworkRuleSet'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'shared_private_link_resources': {'key': 'properties.sharedPrivateLinkResources', 'type': '[SharedPrivateLinkResource]'}, + } + + def __init__( + self, + *, + sku: Optional["Sku"] = None, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["Identity"] = None, + replica_count: Optional[int] = 1, + partition_count: Optional[int] = 1, + hosting_mode: Optional[Union[str, "HostingMode"]] = "default", + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = "enabled", + network_rule_set: Optional["NetworkRuleSet"] = None, + **kwargs + ): + super(SearchServiceUpdate, self).__init__(**kwargs) + self.sku = sku + self.location = location + self.tags = tags + self.identity = identity + self.replica_count = replica_count + self.partition_count = partition_count + self.hosting_mode = hosting_mode + self.public_network_access = public_network_access + self.status = None + self.status_details = None + self.provisioning_state = None + self.network_rule_set = network_rule_set + self.private_endpoint_connections = None + self.shared_private_link_resources = None + + +class ShareablePrivateLinkResourceProperties(msrest.serialization.Model): + """Describes the properties of a resource type that has been onboarded to private link service, supported by Azure Cognitive Search. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The resource provider type for the resource that has been onboarded to private link + service, supported by Azure Cognitive Search. + :vartype type: str + :ivar group_id: The resource provider group id for the resource that has been onboarded to + private link service, supported by Azure Cognitive Search. + :vartype group_id: str + :ivar description: The description of the resource type that has been onboarded to private link + service, supported by Azure Cognitive Search. + :vartype description: str + """ + + _validation = { + 'type': {'readonly': True}, + 'group_id': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'group_id': {'key': 'groupId', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ShareablePrivateLinkResourceProperties, self).__init__(**kwargs) + self.type = None + self.group_id = None + self.description = None + + +class ShareablePrivateLinkResourceType(msrest.serialization.Model): + """Describes an resource type that has been onboarded to private link service, supported by Azure Cognitive Search. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the resource type that has been onboarded to private link service, + supported by Azure Cognitive Search. + :vartype name: str + :ivar properties: Describes the properties of a resource type that has been onboarded to + private link service, supported by Azure Cognitive Search. + :vartype properties: ~azure.mgmt.search.models.ShareablePrivateLinkResourceProperties + """ + + _validation = { + 'name': {'readonly': True}, + 'properties': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ShareablePrivateLinkResourceProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(ShareablePrivateLinkResourceType, self).__init__(**kwargs) + self.name = None + self.properties = None + + +class SharedPrivateLinkResource(Resource): + """Describes a Shared Private Link Resource managed by the Azure Cognitive Search service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param properties: Describes the properties of a Shared Private Link Resource managed by the + Azure Cognitive Search service. + :type properties: ~azure.mgmt.search.models.SharedPrivateLinkResourceProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'SharedPrivateLinkResourceProperties'}, + } + + def __init__( + self, + *, + properties: Optional["SharedPrivateLinkResourceProperties"] = None, + **kwargs + ): + super(SharedPrivateLinkResource, self).__init__(**kwargs) + self.properties = properties + + +class SharedPrivateLinkResourceListResult(msrest.serialization.Model): + """Response containing a list of Shared Private Link Resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of Shared Private Link Resources. + :vartype value: list[~azure.mgmt.search.models.SharedPrivateLinkResource] + :param next_link: The URL to get the next set of shared private link resources, if there are + any. + :type next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SharedPrivateLinkResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + **kwargs + ): + super(SharedPrivateLinkResourceListResult, self).__init__(**kwargs) + self.value = None + self.next_link = next_link + + +class SharedPrivateLinkResourceProperties(msrest.serialization.Model): + """Describes the properties of an existing Shared Private Link Resource managed by the Azure Cognitive Search service. + + :param private_link_resource_id: The resource id of the resource the shared private link + resource is for. + :type private_link_resource_id: str + :param group_id: The group id from the provider of resource the shared private link resource is + for. + :type group_id: str + :param request_message: The request message for requesting approval of the shared private link + resource. + :type request_message: str + :param resource_region: Optional. Can be used to specify the Azure Resource Manager location of + the resource to which a shared private link is to be created. This is only required for those + resources whose DNS configuration are regional (such as Azure Kubernetes Service). + :type resource_region: str + :param status: Status of the shared private link resource. Can be Pending, Approved, Rejected + or Disconnected. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + :type status: str or ~azure.mgmt.search.models.SharedPrivateLinkResourceStatus + :param provisioning_state: The provisioning state of the shared private link resource. Can be + Updating, Deleting, Failed, Succeeded or Incomplete. Possible values include: "Updating", + "Deleting", "Failed", "Succeeded", "Incomplete". + :type provisioning_state: str or + ~azure.mgmt.search.models.SharedPrivateLinkResourceProvisioningState + """ + + _attribute_map = { + 'private_link_resource_id': {'key': 'privateLinkResourceId', 'type': 'str'}, + 'group_id': {'key': 'groupId', 'type': 'str'}, + 'request_message': {'key': 'requestMessage', 'type': 'str'}, + 'resource_region': {'key': 'resourceRegion', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + private_link_resource_id: Optional[str] = None, + group_id: Optional[str] = None, + request_message: Optional[str] = None, + resource_region: Optional[str] = None, + status: Optional[Union[str, "SharedPrivateLinkResourceStatus"]] = None, + provisioning_state: Optional[Union[str, "SharedPrivateLinkResourceProvisioningState"]] = None, + **kwargs + ): + super(SharedPrivateLinkResourceProperties, self).__init__(**kwargs) + self.private_link_resource_id = private_link_resource_id + self.group_id = group_id + self.request_message = request_message + self.resource_region = resource_region + self.status = status + self.provisioning_state = provisioning_state + + +class Sku(msrest.serialization.Model): + """Defines the SKU of an Azure Cognitive Search Service, which determines price tier and capacity limits. + + :param name: The SKU of the search service. Valid values include: 'free': Shared service. + 'basic': Dedicated service with up to 3 replicas. 'standard': Dedicated service with up to 12 + partitions and 12 replicas. 'standard2': Similar to standard, but with more capacity per search + unit. 'standard3': The largest Standard offering with up to 12 partitions and 12 replicas (or + up to 3 partitions with more indexes if you also set the hostingMode property to + 'highDensity'). 'storage_optimized_l1': Supports 1TB per partition, up to 12 partitions. + 'storage_optimized_l2': Supports 2TB per partition, up to 12 partitions.'. Possible values + include: "free", "basic", "standard", "standard2", "standard3", "storage_optimized_l1", + "storage_optimized_l2". + :type name: str or ~azure.mgmt.search.models.SkuName + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[Union[str, "SkuName"]] = None, + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = name diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_search_management_client_enums.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_search_management_client_enums.py new file mode 100644 index 000000000000..dcf1986edb74 --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_search_management_client_enums.py @@ -0,0 +1,157 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class AdminKeyKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + PRIMARY = "primary" + SECONDARY = "secondary" + +class HostingMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Applicable only for the standard3 SKU. You can set this property to enable up to 3 high density + partitions that allow up to 1000 indexes, which is much higher than the maximum indexes allowed + for any other SKU. For the standard3 SKU, the value is either 'default' or 'highDensity'. For + all other SKUs, this value must be 'default'. + """ + + DEFAULT = "default" + HIGH_DENSITY = "highDensity" + +class IdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The identity type. + """ + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + +class PrivateLinkServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Status of the the private link service connection. Can be Pending, Approved, Rejected, or + Disconnected. + """ + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + DISCONNECTED = "Disconnected" + +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The state of the last provisioning operation performed on the search service. Provisioning is + an intermediate state that occurs while service capacity is being established. After capacity + is set up, provisioningState changes to either 'succeeded' or 'failed'. Client applications can + poll provisioning status (the recommended polling interval is from 30 seconds to one minute) by + using the Get Search Service operation to see when an operation is completed. If you are using + the free service, this value tends to come back as 'succeeded' directly in the call to Create + search service. This is because the free service uses capacity that is already set up. + """ + + SUCCEEDED = "succeeded" + PROVISIONING = "provisioning" + FAILED = "failed" + +class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """This value can be set to 'enabled' to avoid breaking changes on existing customer resources and + templates. If set to 'disabled', traffic over public interface is not allowed, and private + endpoint connections would be the exclusive access method. + """ + + ENABLED = "enabled" + DISABLED = "disabled" + +class SearchServiceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The status of the search service. Possible values include: 'running': The search service is + running and no provisioning operations are underway. 'provisioning': The search service is + being provisioned or scaled up or down. 'deleting': The search service is being deleted. + 'degraded': The search service is degraded. This can occur when the underlying search units are + not healthy. The search service is most likely operational, but performance might be slow and + some requests might be dropped. 'disabled': The search service is disabled. In this state, the + service will reject all API requests. 'error': The search service is in an error state. If your + service is in the degraded, disabled, or error states, it means the Azure Cognitive Search team + is actively investigating the underlying issue. Dedicated services in these states are still + chargeable based on the number of search units provisioned. + """ + + RUNNING = "running" + PROVISIONING = "provisioning" + DELETING = "deleting" + DEGRADED = "degraded" + DISABLED = "disabled" + ERROR = "error" + +class SharedPrivateLinkResourceAsyncOperationResult(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The current status of the long running asynchronous shared private link resource operation. + """ + + RUNNING = "Running" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + +class SharedPrivateLinkResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The provisioning state of the shared private link resource. Can be Updating, Deleting, Failed, + Succeeded or Incomplete. + """ + + UPDATING = "Updating" + DELETING = "Deleting" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + INCOMPLETE = "Incomplete" + +class SharedPrivateLinkResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Status of the shared private link resource. Can be Pending, Approved, Rejected or Disconnected. + """ + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + DISCONNECTED = "Disconnected" + +class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The SKU of the search service. Valid values include: 'free': Shared service. 'basic': Dedicated + service with up to 3 replicas. 'standard': Dedicated service with up to 12 partitions and 12 + replicas. 'standard2': Similar to standard, but with more capacity per search unit. + 'standard3': The largest Standard offering with up to 12 partitions and 12 replicas (or up to 3 + partitions with more indexes if you also set the hostingMode property to 'highDensity'). + 'storage_optimized_l1': Supports 1TB per partition, up to 12 partitions. + 'storage_optimized_l2': Supports 2TB per partition, up to 12 partitions.' + """ + + FREE = "free" + BASIC = "basic" + STANDARD = "standard" + STANDARD2 = "standard2" + STANDARD3 = "standard3" + STORAGE_OPTIMIZED_L1 = "storage_optimized_l1" + STORAGE_OPTIMIZED_L2 = "storage_optimized_l2" + +class UnavailableNameReason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The reason why the name is not available. 'Invalid' indicates the name provided does not match + the naming requirements (incorrect length, unsupported characters, etc.). 'AlreadyExists' + indicates that the name is already in use and is therefore unavailable. + """ + + INVALID = "Invalid" + ALREADY_EXISTS = "AlreadyExists" diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/admin_key_result.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/admin_key_result.py deleted file mode 100644 index bfeabe50e70e..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/admin_key_result.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class AdminKeyResult(Model): - """Response containing the primary and secondary admin API keys for a given - Azure Search service. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar primary_key: The primary admin API key of the Search service. - :vartype primary_key: str - :ivar secondary_key: The secondary admin API key of the Search service. - :vartype secondary_key: str - """ - - _validation = { - 'primary_key': {'readonly': True}, - 'secondary_key': {'readonly': True}, - } - - _attribute_map = { - 'primary_key': {'key': 'primaryKey', 'type': 'str'}, - 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(AdminKeyResult, self).__init__(**kwargs) - self.primary_key = None - self.secondary_key = None diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/admin_key_result_py3.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/admin_key_result_py3.py deleted file mode 100644 index 29217db297ce..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/admin_key_result_py3.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class AdminKeyResult(Model): - """Response containing the primary and secondary admin API keys for a given - Azure Search service. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar primary_key: The primary admin API key of the Search service. - :vartype primary_key: str - :ivar secondary_key: The secondary admin API key of the Search service. - :vartype secondary_key: str - """ - - _validation = { - 'primary_key': {'readonly': True}, - 'secondary_key': {'readonly': True}, - } - - _attribute_map = { - 'primary_key': {'key': 'primaryKey', 'type': 'str'}, - 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, - } - - def __init__(self, **kwargs) -> None: - super(AdminKeyResult, self).__init__(**kwargs) - self.primary_key = None - self.secondary_key = None diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/check_name_availability_input.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/check_name_availability_input.py deleted file mode 100644 index 053e06fd8f43..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/check_name_availability_input.py +++ /dev/null @@ -1,48 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class CheckNameAvailabilityInput(Model): - """Input of check name availability API. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The Search service name to validate. Search service - names must only contain lowercase letters, digits or dashes, cannot use - dash as the first two or last one characters, cannot contain consecutive - dashes, and must be between 2 and 60 characters in length. - :type name: str - :ivar type: Required. The type of the resource whose name is to be - validated. This value must always be 'searchServices'. Default value: - "searchServices" . - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "searchServices" - - def __init__(self, **kwargs): - super(CheckNameAvailabilityInput, self).__init__(**kwargs) - self.name = kwargs.get('name', None) diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/check_name_availability_input_py3.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/check_name_availability_input_py3.py deleted file mode 100644 index 012969c50154..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/check_name_availability_input_py3.py +++ /dev/null @@ -1,48 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class CheckNameAvailabilityInput(Model): - """Input of check name availability API. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The Search service name to validate. Search service - names must only contain lowercase letters, digits or dashes, cannot use - dash as the first two or last one characters, cannot contain consecutive - dashes, and must be between 2 and 60 characters in length. - :type name: str - :ivar type: Required. The type of the resource whose name is to be - validated. This value must always be 'searchServices'. Default value: - "searchServices" . - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "searchServices" - - def __init__(self, *, name: str, **kwargs) -> None: - super(CheckNameAvailabilityInput, self).__init__(**kwargs) - self.name = name diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/check_name_availability_output.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/check_name_availability_output.py deleted file mode 100644 index 12b592e51574..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/check_name_availability_output.py +++ /dev/null @@ -1,51 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class CheckNameAvailabilityOutput(Model): - """Output of check name availability API. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar is_name_available: A value indicating whether the name is available. - :vartype is_name_available: bool - :ivar reason: The reason why the name is not available. 'Invalid' - indicates the name provided does not match the naming requirements - (incorrect length, unsupported characters, etc.). 'AlreadyExists' - indicates that the name is already in use and is therefore unavailable. - Possible values include: 'Invalid', 'AlreadyExists' - :vartype reason: str or ~azure.mgmt.search.models.UnavailableNameReason - :ivar message: A message that explains why the name is invalid and - provides resource naming requirements. Available only if 'Invalid' is - returned in the 'reason' property. - :vartype message: str - """ - - _validation = { - 'is_name_available': {'readonly': True}, - 'reason': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'is_name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(CheckNameAvailabilityOutput, self).__init__(**kwargs) - self.is_name_available = None - self.reason = None - self.message = None diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/check_name_availability_output_py3.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/check_name_availability_output_py3.py deleted file mode 100644 index bbffe7f214e1..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/check_name_availability_output_py3.py +++ /dev/null @@ -1,51 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class CheckNameAvailabilityOutput(Model): - """Output of check name availability API. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar is_name_available: A value indicating whether the name is available. - :vartype is_name_available: bool - :ivar reason: The reason why the name is not available. 'Invalid' - indicates the name provided does not match the naming requirements - (incorrect length, unsupported characters, etc.). 'AlreadyExists' - indicates that the name is already in use and is therefore unavailable. - Possible values include: 'Invalid', 'AlreadyExists' - :vartype reason: str or ~azure.mgmt.search.models.UnavailableNameReason - :ivar message: A message that explains why the name is invalid and - provides resource naming requirements. Available only if 'Invalid' is - returned in the 'reason' property. - :vartype message: str - """ - - _validation = { - 'is_name_available': {'readonly': True}, - 'reason': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'is_name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__(self, **kwargs) -> None: - super(CheckNameAvailabilityOutput, self).__init__(**kwargs) - self.is_name_available = None - self.reason = None - self.message = None diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/identity.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/identity.py deleted file mode 100644 index 5d6912d964ce..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/identity.py +++ /dev/null @@ -1,48 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class Identity(Model): - """Identity for the resource. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :param type: Required. The identity type. Possible values include: 'None', - 'SystemAssigned' - :type type: str or ~azure.mgmt.search.models.IdentityType - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'IdentityType'}, - } - - def __init__(self, **kwargs): - super(Identity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/identity_py3.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/identity_py3.py deleted file mode 100644 index 61d3064568ae..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/identity_py3.py +++ /dev/null @@ -1,48 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class Identity(Model): - """Identity for the resource. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :param type: Required. The identity type. Possible values include: 'None', - 'SystemAssigned' - :type type: str or ~azure.mgmt.search.models.IdentityType - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'IdentityType'}, - } - - def __init__(self, *, type, **kwargs) -> None: - super(Identity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = type diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/operation.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/operation.py deleted file mode 100644 index 7269ad98e425..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/operation.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class Operation(Model): - """Describes a REST API operation. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar name: The name of the operation. This name is of the form - {provider}/{resource}/{operation}. - :vartype name: str - :ivar display: The object that describes the operation. - :vartype display: ~azure.mgmt.search.models.OperationDisplay - """ - - _validation = { - 'name': {'readonly': True}, - 'display': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - } - - def __init__(self, **kwargs): - super(Operation, self).__init__(**kwargs) - self.name = None - self.display = None diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/operation_display.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/operation_display.py deleted file mode 100644 index 0c4d5975dc8d..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/operation_display.py +++ /dev/null @@ -1,51 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class OperationDisplay(Model): - """The object that describes the operation. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar provider: The friendly name of the resource provider. - :vartype provider: str - :ivar operation: The operation type: read, write, delete, listKeys/action, - etc. - :vartype operation: str - :ivar resource: The resource type on which the operation is performed. - :vartype resource: str - :ivar description: The friendly name of the operation. - :vartype description: str - """ - - _validation = { - 'provider': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - } - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = None - self.operation = None - self.resource = None - self.description = None diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/operation_display_py3.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/operation_display_py3.py deleted file mode 100644 index a1e6e6bfc353..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/operation_display_py3.py +++ /dev/null @@ -1,51 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class OperationDisplay(Model): - """The object that describes the operation. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar provider: The friendly name of the resource provider. - :vartype provider: str - :ivar operation: The operation type: read, write, delete, listKeys/action, - etc. - :vartype operation: str - :ivar resource: The resource type on which the operation is performed. - :vartype resource: str - :ivar description: The friendly name of the operation. - :vartype description: str - """ - - _validation = { - 'provider': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - } - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__(self, **kwargs) -> None: - super(OperationDisplay, self).__init__(**kwargs) - self.provider = None - self.operation = None - self.resource = None - self.description = None diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/operation_paged.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/operation_paged.py deleted file mode 100644 index 6aaeff67cdb2..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/operation_paged.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.paging import Paged - - -class OperationPaged(Paged): - """ - A paging container for iterating over a list of :class:`Operation ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Operation]'} - } - - def __init__(self, *args, **kwargs): - - super(OperationPaged, self).__init__(*args, **kwargs) diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/operation_py3.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/operation_py3.py deleted file mode 100644 index 1b4dbae10d28..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/operation_py3.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class Operation(Model): - """Describes a REST API operation. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar name: The name of the operation. This name is of the form - {provider}/{resource}/{operation}. - :vartype name: str - :ivar display: The object that describes the operation. - :vartype display: ~azure.mgmt.search.models.OperationDisplay - """ - - _validation = { - 'name': {'readonly': True}, - 'display': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - } - - def __init__(self, **kwargs) -> None: - super(Operation, self).__init__(**kwargs) - self.name = None - self.display = None diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/query_key.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/query_key.py deleted file mode 100644 index 4b4f282ed5eb..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/query_key.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class QueryKey(Model): - """Describes an API key for a given Azure Search service that has permissions - for query operations only. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar name: The name of the query API key; may be empty. - :vartype name: str - :ivar key: The value of the query API key. - :vartype key: str - """ - - _validation = { - 'name': {'readonly': True}, - 'key': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(QueryKey, self).__init__(**kwargs) - self.name = None - self.key = None diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/query_key_paged.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/query_key_paged.py deleted file mode 100644 index f1fc2d9aade8..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/query_key_paged.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.paging import Paged - - -class QueryKeyPaged(Paged): - """ - A paging container for iterating over a list of :class:`QueryKey ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[QueryKey]'} - } - - def __init__(self, *args, **kwargs): - - super(QueryKeyPaged, self).__init__(*args, **kwargs) diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/query_key_py3.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/query_key_py3.py deleted file mode 100644 index e02c33495eed..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/query_key_py3.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class QueryKey(Model): - """Describes an API key for a given Azure Search service that has permissions - for query operations only. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar name: The name of the query API key; may be empty. - :vartype name: str - :ivar key: The value of the query API key. - :vartype key: str - """ - - _validation = { - 'name': {'readonly': True}, - 'key': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, - } - - def __init__(self, **kwargs) -> None: - super(QueryKey, self).__init__(**kwargs) - self.name = None - self.key = None diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/resource.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/resource.py deleted file mode 100644 index 8dc5dd8833f9..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/resource.py +++ /dev/null @@ -1,61 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class Resource(Model): - """Base type for all Azure resources. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: The ID of the resource. This can be used with the Azure Resource - Manager to link resources together. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - :param location: The geographic location of the resource. This must be one - of the supported and registered Azure Geo Regions (for example, West US, - East US, Southeast Asia, and so forth). This property is required when - creating a new resource. - :type location: str - :param tags: Tags to help categorize the resource in the Azure portal. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.search.models.Identity - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - } - - def __init__(self, **kwargs): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/resource_py3.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/resource_py3.py deleted file mode 100644 index 752e7a2cbbb9..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/resource_py3.py +++ /dev/null @@ -1,61 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class Resource(Model): - """Base type for all Azure resources. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: The ID of the resource. This can be used with the Azure Resource - Manager to link resources together. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - :param location: The geographic location of the resource. This must be one - of the supported and registered Azure Geo Regions (for example, West US, - East US, Southeast Asia, and so forth). This property is required when - creating a new resource. - :type location: str - :param tags: Tags to help categorize the resource in the Azure portal. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.search.models.Identity - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - } - - def __init__(self, *, location: str=None, tags=None, identity=None, **kwargs) -> None: - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location - self.tags = tags - self.identity = identity diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/search_management_client_enums.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/search_management_client_enums.py deleted file mode 100644 index cf76e9f19b0d..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/search_management_client_enums.py +++ /dev/null @@ -1,64 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum - - -class UnavailableNameReason(str, Enum): - - invalid = "Invalid" - already_exists = "AlreadyExists" - - -class SkuName(str, Enum): - - free = "free" - basic = "basic" - standard = "standard" - standard2 = "standard2" - standard3 = "standard3" - storage_optimized_l1 = "storage_optimized_l1" - storage_optimized_l2 = "storage_optimized_l2" - - -class HostingMode(str, Enum): - - default = "default" - high_density = "highDensity" - - -class SearchServiceStatus(str, Enum): - - running = "running" - provisioning = "provisioning" - deleting = "deleting" - degraded = "degraded" - disabled = "disabled" - error = "error" - - -class ProvisioningState(str, Enum): - - succeeded = "succeeded" - provisioning = "provisioning" - failed = "failed" - - -class IdentityType(str, Enum): - - none = "None" - system_assigned = "SystemAssigned" - - -class AdminKeyKind(str, Enum): - - primary = "primary" - secondary = "secondary" diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/search_management_request_options.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/search_management_request_options.py deleted file mode 100644 index 96e0dc7df52e..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/search_management_request_options.py +++ /dev/null @@ -1,30 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class SearchManagementRequestOptions(Model): - """Additional parameters for a set of operations. - - :param client_request_id: A client-generated GUID value that identifies - this request. If specified, this will be included in response information - as a way to track the request. - :type client_request_id: str - """ - - _attribute_map = { - 'client_request_id': {'key': '', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(SearchManagementRequestOptions, self).__init__(**kwargs) - self.client_request_id = kwargs.get('client_request_id', None) diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/search_management_request_options_py3.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/search_management_request_options_py3.py deleted file mode 100644 index 3e36e9a15800..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/search_management_request_options_py3.py +++ /dev/null @@ -1,30 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class SearchManagementRequestOptions(Model): - """Additional parameters for a set of operations. - - :param client_request_id: A client-generated GUID value that identifies - this request. If specified, this will be included in response information - as a way to track the request. - :type client_request_id: str - """ - - _attribute_map = { - 'client_request_id': {'key': '', 'type': 'str'}, - } - - def __init__(self, *, client_request_id: str=None, **kwargs) -> None: - super(SearchManagementRequestOptions, self).__init__(**kwargs) - self.client_request_id = client_request_id diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/search_service.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/search_service.py deleted file mode 100644 index 6bd3de6791de..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/search_service.py +++ /dev/null @@ -1,124 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .resource import Resource - - -class SearchService(Resource): - """Describes an Azure Search service and its current state. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: The ID of the resource. This can be used with the Azure Resource - Manager to link resources together. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - :param location: The geographic location of the resource. This must be one - of the supported and registered Azure Geo Regions (for example, West US, - East US, Southeast Asia, and so forth). This property is required when - creating a new resource. - :type location: str - :param tags: Tags to help categorize the resource in the Azure portal. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.search.models.Identity - :param replica_count: The number of replicas in the Search service. If - specified, it must be a value between 1 and 12 inclusive for standard SKUs - or between 1 and 3 inclusive for basic SKU. Default value: 1 . - :type replica_count: int - :param partition_count: The number of partitions in the Search service; if - specified, it can be 1, 2, 3, 4, 6, or 12. Values greater than 1 are only - valid for standard SKUs. For 'standard3' services with hostingMode set to - 'highDensity', the allowed values are between 1 and 3. Default value: 1 . - :type partition_count: int - :param hosting_mode: Applicable only for the standard3 SKU. You can set - this property to enable up to 3 high density partitions that allow up to - 1000 indexes, which is much higher than the maximum indexes allowed for - any other SKU. For the standard3 SKU, the value is either 'default' or - 'highDensity'. For all other SKUs, this value must be 'default'. Possible - values include: 'default', 'highDensity'. Default value: "default" . - :type hosting_mode: str or ~azure.mgmt.search.models.HostingMode - :ivar status: The status of the Search service. Possible values include: - 'running': The Search service is running and no provisioning operations - are underway. 'provisioning': The Search service is being provisioned or - scaled up or down. 'deleting': The Search service is being deleted. - 'degraded': The Search service is degraded. This can occur when the - underlying search units are not healthy. The Search service is most likely - operational, but performance might be slow and some requests might be - dropped. 'disabled': The Search service is disabled. In this state, the - service will reject all API requests. 'error': The Search service is in an - error state. If your service is in the degraded, disabled, or error - states, it means the Azure Search team is actively investigating the - underlying issue. Dedicated services in these states are still chargeable - based on the number of search units provisioned. Possible values include: - 'running', 'provisioning', 'deleting', 'degraded', 'disabled', 'error' - :vartype status: str or ~azure.mgmt.search.models.SearchServiceStatus - :ivar status_details: The details of the Search service status. - :vartype status_details: str - :ivar provisioning_state: The state of the last provisioning operation - performed on the Search service. Provisioning is an intermediate state - that occurs while service capacity is being established. After capacity is - set up, provisioningState changes to either 'succeeded' or 'failed'. - Client applications can poll provisioning status (the recommended polling - interval is from 30 seconds to one minute) by using the Get Search Service - operation to see when an operation is completed. If you are using the free - service, this value tends to come back as 'succeeded' directly in the call - to Create Search service. This is because the free service uses capacity - that is already set up. Possible values include: 'succeeded', - 'provisioning', 'failed' - :vartype provisioning_state: str or - ~azure.mgmt.search.models.ProvisioningState - :param sku: The SKU of the Search Service, which determines price tier and - capacity limits. This property is required when creating a new Search - Service. - :type sku: ~azure.mgmt.search.models.Sku - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'replica_count': {'maximum': 12, 'minimum': 1}, - 'partition_count': {'maximum': 12, 'minimum': 1}, - 'status': {'readonly': True}, - 'status_details': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'replica_count': {'key': 'properties.replicaCount', 'type': 'int'}, - 'partition_count': {'key': 'properties.partitionCount', 'type': 'int'}, - 'hosting_mode': {'key': 'properties.hostingMode', 'type': 'HostingMode'}, - 'status': {'key': 'properties.status', 'type': 'SearchServiceStatus'}, - 'status_details': {'key': 'properties.statusDetails', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - } - - def __init__(self, **kwargs): - super(SearchService, self).__init__(**kwargs) - self.replica_count = kwargs.get('replica_count', 1) - self.partition_count = kwargs.get('partition_count', 1) - self.hosting_mode = kwargs.get('hosting_mode', "default") - self.status = None - self.status_details = None - self.provisioning_state = None - self.sku = kwargs.get('sku', None) diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/search_service_paged.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/search_service_paged.py deleted file mode 100644 index dbb3236affea..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/search_service_paged.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.paging import Paged - - -class SearchServicePaged(Paged): - """ - A paging container for iterating over a list of :class:`SearchService ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SearchService]'} - } - - def __init__(self, *args, **kwargs): - - super(SearchServicePaged, self).__init__(*args, **kwargs) diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/search_service_py3.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/search_service_py3.py deleted file mode 100644 index 823afff5b9a5..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/search_service_py3.py +++ /dev/null @@ -1,124 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .resource_py3 import Resource - - -class SearchService(Resource): - """Describes an Azure Search service and its current state. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: The ID of the resource. This can be used with the Azure Resource - Manager to link resources together. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - :param location: The geographic location of the resource. This must be one - of the supported and registered Azure Geo Regions (for example, West US, - East US, Southeast Asia, and so forth). This property is required when - creating a new resource. - :type location: str - :param tags: Tags to help categorize the resource in the Azure portal. - :type tags: dict[str, str] - :param identity: The identity of the resource. - :type identity: ~azure.mgmt.search.models.Identity - :param replica_count: The number of replicas in the Search service. If - specified, it must be a value between 1 and 12 inclusive for standard SKUs - or between 1 and 3 inclusive for basic SKU. Default value: 1 . - :type replica_count: int - :param partition_count: The number of partitions in the Search service; if - specified, it can be 1, 2, 3, 4, 6, or 12. Values greater than 1 are only - valid for standard SKUs. For 'standard3' services with hostingMode set to - 'highDensity', the allowed values are between 1 and 3. Default value: 1 . - :type partition_count: int - :param hosting_mode: Applicable only for the standard3 SKU. You can set - this property to enable up to 3 high density partitions that allow up to - 1000 indexes, which is much higher than the maximum indexes allowed for - any other SKU. For the standard3 SKU, the value is either 'default' or - 'highDensity'. For all other SKUs, this value must be 'default'. Possible - values include: 'default', 'highDensity'. Default value: "default" . - :type hosting_mode: str or ~azure.mgmt.search.models.HostingMode - :ivar status: The status of the Search service. Possible values include: - 'running': The Search service is running and no provisioning operations - are underway. 'provisioning': The Search service is being provisioned or - scaled up or down. 'deleting': The Search service is being deleted. - 'degraded': The Search service is degraded. This can occur when the - underlying search units are not healthy. The Search service is most likely - operational, but performance might be slow and some requests might be - dropped. 'disabled': The Search service is disabled. In this state, the - service will reject all API requests. 'error': The Search service is in an - error state. If your service is in the degraded, disabled, or error - states, it means the Azure Search team is actively investigating the - underlying issue. Dedicated services in these states are still chargeable - based on the number of search units provisioned. Possible values include: - 'running', 'provisioning', 'deleting', 'degraded', 'disabled', 'error' - :vartype status: str or ~azure.mgmt.search.models.SearchServiceStatus - :ivar status_details: The details of the Search service status. - :vartype status_details: str - :ivar provisioning_state: The state of the last provisioning operation - performed on the Search service. Provisioning is an intermediate state - that occurs while service capacity is being established. After capacity is - set up, provisioningState changes to either 'succeeded' or 'failed'. - Client applications can poll provisioning status (the recommended polling - interval is from 30 seconds to one minute) by using the Get Search Service - operation to see when an operation is completed. If you are using the free - service, this value tends to come back as 'succeeded' directly in the call - to Create Search service. This is because the free service uses capacity - that is already set up. Possible values include: 'succeeded', - 'provisioning', 'failed' - :vartype provisioning_state: str or - ~azure.mgmt.search.models.ProvisioningState - :param sku: The SKU of the Search Service, which determines price tier and - capacity limits. This property is required when creating a new Search - Service. - :type sku: ~azure.mgmt.search.models.Sku - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'replica_count': {'maximum': 12, 'minimum': 1}, - 'partition_count': {'maximum': 12, 'minimum': 1}, - 'status': {'readonly': True}, - 'status_details': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'replica_count': {'key': 'properties.replicaCount', 'type': 'int'}, - 'partition_count': {'key': 'properties.partitionCount', 'type': 'int'}, - 'hosting_mode': {'key': 'properties.hostingMode', 'type': 'HostingMode'}, - 'status': {'key': 'properties.status', 'type': 'SearchServiceStatus'}, - 'status_details': {'key': 'properties.statusDetails', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - } - - def __init__(self, *, location: str=None, tags=None, identity=None, replica_count: int=1, partition_count: int=1, hosting_mode="default", sku=None, **kwargs) -> None: - super(SearchService, self).__init__(location=location, tags=tags, identity=identity, **kwargs) - self.replica_count = replica_count - self.partition_count = partition_count - self.hosting_mode = hosting_mode - self.status = None - self.status_details = None - self.provisioning_state = None - self.sku = sku diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/sku.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/sku.py deleted file mode 100644 index 375894ee72ca..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/sku.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class Sku(Model): - """Defines the SKU of an Azure Search Service, which determines price tier and - capacity limits. - - :param name: The SKU of the Search service. Valid values include: 'free': - Shared service. 'basic': Dedicated service with up to 3 replicas. - 'standard': Dedicated service with up to 12 partitions and 12 replicas. - 'standard2': Similar to standard, but with more capacity per search unit. - 'standard3': The largest Standard offering with up to 12 partitions and 12 - replicas (or up to 3 partitions with more indexes if you also set the - hostingMode property to 'highDensity'). 'storage_optimized_l1': Supports - 1TB per partition, up to 12 partitions. 'storage_optimized_l2': Supports - 2TB per partition, up to 12 partitions.'. Possible values include: 'free', - 'basic', 'standard', 'standard2', 'standard3', 'storage_optimized_l1', - 'storage_optimized_l2' - :type name: str or ~azure.mgmt.search.models.SkuName - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'SkuName'}, - } - - def __init__(self, **kwargs): - super(Sku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/sku_py3.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/sku_py3.py deleted file mode 100644 index aae43fc4e4b7..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/sku_py3.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class Sku(Model): - """Defines the SKU of an Azure Search Service, which determines price tier and - capacity limits. - - :param name: The SKU of the Search service. Valid values include: 'free': - Shared service. 'basic': Dedicated service with up to 3 replicas. - 'standard': Dedicated service with up to 12 partitions and 12 replicas. - 'standard2': Similar to standard, but with more capacity per search unit. - 'standard3': The largest Standard offering with up to 12 partitions and 12 - replicas (or up to 3 partitions with more indexes if you also set the - hostingMode property to 'highDensity'). 'storage_optimized_l1': Supports - 1TB per partition, up to 12 partitions. 'storage_optimized_l2': Supports - 2TB per partition, up to 12 partitions.'. Possible values include: 'free', - 'basic', 'standard', 'standard2', 'standard3', 'storage_optimized_l1', - 'storage_optimized_l2' - :type name: str or ~azure.mgmt.search.models.SkuName - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'SkuName'}, - } - - def __init__(self, *, name=None, **kwargs) -> None: - super(Sku, self).__init__(**kwargs) - self.name = name diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/__init__.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/__init__.py index 4b49a00e8eb1..7cef1dd388a1 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/__init__.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/__init__.py @@ -1,22 +1,25 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from .operations import Operations -from .admin_keys_operations import AdminKeysOperations -from .query_keys_operations import QueryKeysOperations -from .services_operations import ServicesOperations +from ._operations import Operations +from ._admin_keys_operations import AdminKeysOperations +from ._query_keys_operations import QueryKeysOperations +from ._services_operations import ServicesOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._shared_private_link_resources_operations import SharedPrivateLinkResourcesOperations __all__ = [ 'Operations', 'AdminKeysOperations', 'QueryKeysOperations', 'ServicesOperations', + 'PrivateLinkResourcesOperations', + 'PrivateEndpointConnectionsOperations', + 'SharedPrivateLinkResourcesOperations', ] diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_admin_keys_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_admin_keys_operations.py new file mode 100644 index 000000000000..42dd5456922d --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_admin_keys_operations.py @@ -0,0 +1,191 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class AdminKeysOperations(object): + """AdminKeysOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.search.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + search_service_name, # type: str + search_management_request_options=None, # type: Optional["models.SearchManagementRequestOptions"] + **kwargs # type: Any + ): + # type: (...) -> "models.AdminKeyResult" + """Gets the primary and secondary admin API keys for the specified Azure Cognitive Search service. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AdminKeyResult, or the result of cls(response) + :rtype: ~azure.mgmt.search.models.AdminKeyResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AdminKeyResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AdminKeyResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listAdminKeys'} # type: ignore + + def regenerate( + self, + resource_group_name, # type: str + search_service_name, # type: str + key_kind, # type: Union[str, "models.AdminKeyKind"] + search_management_request_options=None, # type: Optional["models.SearchManagementRequestOptions"] + **kwargs # type: Any + ): + # type: (...) -> "models.AdminKeyResult" + """Regenerates either the primary or secondary admin API key. You can only regenerate one key at a + time. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param key_kind: Specifies which key to regenerate. Valid values include 'primary' and + 'secondary'. + :type key_kind: str or ~azure.mgmt.search.models.AdminKeyKind + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AdminKeyResult, or the result of cls(response) + :rtype: ~azure.mgmt.search.models.AdminKeyResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AdminKeyResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + # Construct URL + url = self.regenerate.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + 'keyKind': self._serialize.url("key_kind", key_kind, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AdminKeyResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/regenerateAdminKey/{keyKind}'} # type: ignore diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_operations.py new file mode 100644 index 000000000000..d375b55422df --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_operations.py @@ -0,0 +1,109 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.search.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.OperationListResult"] + """Lists all of the available REST API operations of the Microsoft.Search provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.search.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Search/operations'} # type: ignore diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_private_endpoint_connections_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..9c23e3a88176 --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,369 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsOperations(object): + """PrivateEndpointConnectionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.search.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def update( + self, + resource_group_name, # type: str + search_service_name, # type: str + private_endpoint_connection_name, # type: str + private_endpoint_connection, # type: "models.PrivateEndpointConnection" + search_management_request_options=None, # type: Optional["models.SearchManagementRequestOptions"] + **kwargs # type: Any + ): + # type: (...) -> "models.PrivateEndpointConnection" + """Updates a Private Endpoint connection to the search service in the given resource group. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection to the + Azure Cognitive Search service with the specified resource group. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The definition of the private endpoint connection to + update. + :type private_endpoint_connection: ~azure.mgmt.search.models.PrivateEndpointConnection + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + search_service_name, # type: str + private_endpoint_connection_name, # type: str + search_management_request_options=None, # type: Optional["models.SearchManagementRequestOptions"] + **kwargs # type: Any + ): + # type: (...) -> "models.PrivateEndpointConnection" + """Gets the details of the private endpoint connection to the search service in the given resource + group. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection to the + Azure Cognitive Search service with the specified resource group. + :type private_endpoint_connection_name: str + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + search_service_name, # type: str + private_endpoint_connection_name, # type: str + search_management_request_options=None, # type: Optional["models.SearchManagementRequestOptions"] + **kwargs # type: Any + ): + # type: (...) -> Optional["models.PrivateEndpointConnection"] + """Disconnects the private endpoint connection and deletes it from the search service. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection to the + Azure Cognitive Search service with the specified resource group. + :type private_endpoint_connection_name: str + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PrivateEndpointConnection"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def list_by_service( + self, + resource_group_name, # type: str + search_service_name, # type: str + search_management_request_options=None, # type: Optional["models.SearchManagementRequestOptions"] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.PrivateEndpointConnectionListResult"] + """Gets a list of all private endpoint connections in the given service. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.search.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_service.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections'} # type: ignore diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_private_link_resources_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..a87da3ad0a38 --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_private_link_resources_operations.py @@ -0,0 +1,132 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PrivateLinkResourcesOperations(object): + """PrivateLinkResourcesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.search.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_supported( + self, + resource_group_name, # type: str + search_service_name, # type: str + search_management_request_options=None, # type: Optional["models.SearchManagementRequestOptions"] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.PrivateLinkResourcesResult"] + """Gets a list of all supported private link resource types for the given service. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateLinkResourcesResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.search.models.PrivateLinkResourcesResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourcesResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_supported.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateLinkResourcesResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_supported.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateLinkResources'} # type: ignore diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_query_keys_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_query_keys_operations.py new file mode 100644 index 000000000000..40ff42696592 --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_query_keys_operations.py @@ -0,0 +1,279 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class QueryKeysOperations(object): + """QueryKeysOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.search.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def create( + self, + resource_group_name, # type: str + search_service_name, # type: str + name, # type: str + search_management_request_options=None, # type: Optional["models.SearchManagementRequestOptions"] + **kwargs # type: Any + ): + # type: (...) -> "models.QueryKey" + """Generates a new query key for the specified search service. You can create up to 50 query keys + per service. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param name: The name of the new query API key. + :type name: str + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QueryKey, or the result of cls(response) + :rtype: ~azure.mgmt.search.models.QueryKey + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.QueryKey"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('QueryKey', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/createQueryKey/{name}'} # type: ignore + + def list_by_search_service( + self, + resource_group_name, # type: str + search_service_name, # type: str + search_management_request_options=None, # type: Optional["models.SearchManagementRequestOptions"] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ListQueryKeysResult"] + """Returns the list of query API keys for the given Azure Cognitive Search service. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ListQueryKeysResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.search.models.ListQueryKeysResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ListQueryKeysResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_search_service.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ListQueryKeysResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_search_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listQueryKeys'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + search_service_name, # type: str + key, # type: str + search_management_request_options=None, # type: Optional["models.SearchManagementRequestOptions"] + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process + for regenerating a query key is to delete and then recreate it. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param key: The query key to be deleted. Query keys are identified by value, not by name. + :type key: str + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + 'key': self._serialize.url("key", key, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/deleteQueryKey/{key}'} # type: ignore diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_services_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_services_operations.py new file mode 100644 index 000000000000..acdcb460fc30 --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_services_operations.py @@ -0,0 +1,635 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ServicesOperations(object): + """ServicesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.search.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _create_or_update_initial( + self, + resource_group_name, # type: str + search_service_name, # type: str + service, # type: "models.SearchService" + search_management_request_options=None, # type: Optional["models.SearchManagementRequestOptions"] + **kwargs # type: Any + ): + # type: (...) -> "models.SearchService" + cls = kwargs.pop('cls', None) # type: ClsType["models.SearchService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(service, 'SearchService') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SearchService', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SearchService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + search_service_name, # type: str + service, # type: "models.SearchService" + search_management_request_options=None, # type: Optional["models.SearchManagementRequestOptions"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.SearchService"] + """Creates or updates a search service in the given resource group. If the search service already + exists, all properties will be updated with the given values. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service to create or update. + Search service names must only contain lowercase letters, digits or dashes, cannot use dash as + the first two or last one characters, cannot contain consecutive dashes, and must be between 2 + and 60 characters in length. Search service names must be globally unique since they are part + of the service URI (https://:code:``.search.windows.net). You cannot change the service + name after the service is created. + :type search_service_name: str + :param service: The definition of the search service to create or update. + :type service: ~azure.mgmt.search.models.SearchService + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either SearchService or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.search.models.SearchService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.SearchService"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + service=service, + search_management_request_options=search_management_request_options, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SearchService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + search_service_name, # type: str + service, # type: "models.SearchServiceUpdate" + search_management_request_options=None, # type: Optional["models.SearchManagementRequestOptions"] + **kwargs # type: Any + ): + # type: (...) -> "models.SearchService" + """Updates an existing search service in the given resource group. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service to update. + :type search_service_name: str + :param service: The definition of the search service to update. + :type service: ~azure.mgmt.search.models.SearchServiceUpdate + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchService, or the result of cls(response) + :rtype: ~azure.mgmt.search.models.SearchService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SearchService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(service, 'SearchServiceUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SearchService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + search_service_name, # type: str + search_management_request_options=None, # type: Optional["models.SearchManagementRequestOptions"] + **kwargs # type: Any + ): + # type: (...) -> "models.SearchService" + """Gets the search service with the given name in the given resource group. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchService, or the result of cls(response) + :rtype: ~azure.mgmt.search.models.SearchService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SearchService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SearchService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + search_service_name, # type: str + search_management_request_options=None, # type: Optional["models.SearchManagementRequestOptions"] + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a search service in the given resource group, along with its associated resources. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + search_management_request_options=None, # type: Optional["models.SearchManagementRequestOptions"] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SearchServiceListResult"] + """Gets a list of all search services in the given resource group. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SearchServiceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.search.models.SearchServiceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SearchServiceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SearchServiceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices'} # type: ignore + + def list_by_subscription( + self, + search_management_request_options=None, # type: Optional["models.SearchManagementRequestOptions"] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SearchServiceListResult"] + """Gets a list of all search services in the given subscription. + + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SearchServiceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.search.models.SearchServiceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SearchServiceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SearchServiceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Search/searchServices'} # type: ignore + + def check_name_availability( + self, + name, # type: str + search_management_request_options=None, # type: Optional["models.SearchManagementRequestOptions"] + **kwargs # type: Any + ): + # type: (...) -> "models.CheckNameAvailabilityOutput" + """Checks whether or not the given search service name is available for use. Search service names + must be globally unique since they are part of the service URI + (https://:code:``.search.windows.net). + + :param name: The search service name to validate. Search service names must only contain + lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, + cannot contain consecutive dashes, and must be between 2 and 60 characters in length. + :type name: str + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityOutput, or the result of cls(response) + :rtype: ~azure.mgmt.search.models.CheckNameAvailabilityOutput + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityOutput"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + + _check_name_availability_input = models.CheckNameAvailabilityInput(name=name) + api_version = "2020-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_check_name_availability_input, 'CheckNameAvailabilityInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityOutput', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Search/checkNameAvailability'} # type: ignore diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_shared_private_link_resources_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_shared_private_link_resources_operations.py new file mode 100644 index 000000000000..da50099f4c80 --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_shared_private_link_resources_operations.py @@ -0,0 +1,478 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class SharedPrivateLinkResourcesOperations(object): + """SharedPrivateLinkResourcesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.search.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _create_or_update_initial( + self, + resource_group_name, # type: str + search_service_name, # type: str + shared_private_link_resource_name, # type: str + shared_private_link_resource, # type: "models.SharedPrivateLinkResource" + search_management_request_options=None, # type: Optional["models.SearchManagementRequestOptions"] + **kwargs # type: Any + ): + # type: (...) -> Optional["models.SharedPrivateLinkResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SharedPrivateLinkResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + 'sharedPrivateLinkResourceName': self._serialize.url("shared_private_link_resource_name", shared_private_link_resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(shared_private_link_resource, 'SharedPrivateLinkResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SharedPrivateLinkResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + search_service_name, # type: str + shared_private_link_resource_name, # type: str + shared_private_link_resource, # type: "models.SharedPrivateLinkResource" + search_management_request_options=None, # type: Optional["models.SearchManagementRequestOptions"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.SharedPrivateLinkResource"] + """Initiates the creation or update of a shared private link resource managed by the search + service in the given resource group. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param shared_private_link_resource_name: The name of the shared private link resource managed + by the Azure Cognitive Search service within the specified resource group. + :type shared_private_link_resource_name: str + :param shared_private_link_resource: The definition of the shared private link resource to + create or update. + :type shared_private_link_resource: ~azure.mgmt.search.models.SharedPrivateLinkResource + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either SharedPrivateLinkResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.search.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.SharedPrivateLinkResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, + shared_private_link_resource=shared_private_link_resource, + search_management_request_options=search_management_request_options, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SharedPrivateLinkResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + search_service_name, # type: str + shared_private_link_resource_name, # type: str + search_management_request_options=None, # type: Optional["models.SearchManagementRequestOptions"] + **kwargs # type: Any + ): + # type: (...) -> "models.SharedPrivateLinkResource" + """Gets the details of the shared private link resource managed by the search service in the given + resource group. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param shared_private_link_resource_name: The name of the shared private link resource managed + by the Azure Cognitive Search service within the specified resource group. + :type shared_private_link_resource_name: str + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedPrivateLinkResource, or the result of cls(response) + :rtype: ~azure.mgmt.search.models.SharedPrivateLinkResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SharedPrivateLinkResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + 'sharedPrivateLinkResourceName': self._serialize.url("shared_private_link_resource_name", shared_private_link_resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedPrivateLinkResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + search_service_name, # type: str + shared_private_link_resource_name, # type: str + search_management_request_options=None, # type: Optional["models.SearchManagementRequestOptions"] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + 'sharedPrivateLinkResourceName': self._serialize.url("shared_private_link_resource_name", shared_private_link_resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + search_service_name, # type: str + shared_private_link_resource_name, # type: str + search_management_request_options=None, # type: Optional["models.SearchManagementRequestOptions"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Initiates the deletion of the shared private link resource from the search service. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param shared_private_link_resource_name: The name of the shared private link resource managed + by the Azure Cognitive Search service within the specified resource group. + :type shared_private_link_resource_name: str + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, + search_management_request_options=search_management_request_options, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore + + def list_by_service( + self, + resource_group_name, # type: str + search_service_name, # type: str + search_management_request_options=None, # type: Optional["models.SearchManagementRequestOptions"] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SharedPrivateLinkResourceListResult"] + """Gets a list of all shared private link resources managed by the given service. + + :param resource_group_name: The name of the resource group within the current subscription. You + can obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param search_service_name: The name of the Azure Cognitive Search service associated with the + specified resource group. + :type search_service_name: str + :param search_management_request_options: Parameter group. + :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedPrivateLinkResourceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.search.models.SharedPrivateLinkResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SharedPrivateLinkResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + api_version = "2020-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if _client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", _client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_service.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SharedPrivateLinkResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources'} # type: ignore diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/admin_keys_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/admin_keys_operations.py deleted file mode 100644 index 7887d302f3d4..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/admin_keys_operations.py +++ /dev/null @@ -1,195 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError - -from .. import models - - -class AdminKeysOperations(object): - """AdminKeysOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for each request. The current version is 2015-08-19. Constant value: "2015-08-19". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2015-08-19" - - self.config = config - - def get( - self, resource_group_name, search_service_name, search_management_request_options=None, custom_headers=None, raw=False, **operation_config): - """Gets the primary and secondary admin API keys for the specified Azure - Search service. - - :param resource_group_name: The name of the resource group within the - current subscription. You can obtain this value from the Azure - Resource Manager API or the portal. - :type resource_group_name: str - :param search_service_name: The name of the Azure Search service - associated with the specified resource group. - :type search_service_name: str - :param search_management_request_options: Additional parameters for - the operation - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AdminKeyResult or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.search.models.AdminKeyResult or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - client_request_id = None - if search_management_request_options is not None: - client_request_id = search_management_request_options.client_request_id - - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - if client_request_id is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('AdminKeyResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listAdminKeys'} - - def regenerate( - self, resource_group_name, search_service_name, key_kind, search_management_request_options=None, custom_headers=None, raw=False, **operation_config): - """Regenerates either the primary or secondary admin API key. You can only - regenerate one key at a time. - - :param resource_group_name: The name of the resource group within the - current subscription. You can obtain this value from the Azure - Resource Manager API or the portal. - :type resource_group_name: str - :param search_service_name: The name of the Azure Search service - associated with the specified resource group. - :type search_service_name: str - :param key_kind: Specifies which key to regenerate. Valid values - include 'primary' and 'secondary'. Possible values include: 'primary', - 'secondary' - :type key_kind: str or ~azure.mgmt.search.models.AdminKeyKind - :param search_management_request_options: Additional parameters for - the operation - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AdminKeyResult or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.search.models.AdminKeyResult or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - client_request_id = None - if search_management_request_options is not None: - client_request_id = search_management_request_options.client_request_id - - # Construct URL - url = self.regenerate.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), - 'keyKind': self._serialize.url("key_kind", key_kind, 'AdminKeyKind'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - if client_request_id is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('AdminKeyResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - regenerate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/regenerateAdminKey/{keyKind}'} diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/operations.py deleted file mode 100644 index c83587eafb24..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/operations.py +++ /dev/null @@ -1,99 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError - -from .. import models - - -class Operations(object): - """Operations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for each request. The current version is 2015-08-19. Constant value: "2015-08-19". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2015-08-19" - - self.config = config - - def list( - self, custom_headers=None, raw=False, **operation_config): - """Lists all of the available REST API operations of the Microsoft.Search - provider. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Operation - :rtype: - ~azure.mgmt.search.models.OperationPaged[~azure.mgmt.search.models.Operation] - :raises: :class:`CloudError` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list.metadata['url'] - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list.metadata = {'url': '/providers/Microsoft.Search/operations'} diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/query_keys_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/query_keys_operations.py deleted file mode 100644 index 8fb9e29e0309..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/query_keys_operations.py +++ /dev/null @@ -1,272 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError - -from .. import models - - -class QueryKeysOperations(object): - """QueryKeysOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for each request. The current version is 2015-08-19. Constant value: "2015-08-19". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2015-08-19" - - self.config = config - - def create( - self, resource_group_name, search_service_name, name, search_management_request_options=None, custom_headers=None, raw=False, **operation_config): - """Generates a new query key for the specified Search service. You can - create up to 50 query keys per service. - - :param resource_group_name: The name of the resource group within the - current subscription. You can obtain this value from the Azure - Resource Manager API or the portal. - :type resource_group_name: str - :param search_service_name: The name of the Azure Search service - associated with the specified resource group. - :type search_service_name: str - :param name: The name of the new query API key. - :type name: str - :param search_management_request_options: Additional parameters for - the operation - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: QueryKey or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.search.models.QueryKey or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - client_request_id = None - if search_management_request_options is not None: - client_request_id = search_management_request_options.client_request_id - - # Construct URL - url = self.create.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - if client_request_id is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('QueryKey', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/createQueryKey/{name}'} - - def list_by_search_service( - self, resource_group_name, search_service_name, search_management_request_options=None, custom_headers=None, raw=False, **operation_config): - """Returns the list of query API keys for the given Azure Search service. - - :param resource_group_name: The name of the resource group within the - current subscription. You can obtain this value from the Azure - Resource Manager API or the portal. - :type resource_group_name: str - :param search_service_name: The name of the Azure Search service - associated with the specified resource group. - :type search_service_name: str - :param search_management_request_options: Additional parameters for - the operation - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of QueryKey - :rtype: - ~azure.mgmt.search.models.QueryKeyPaged[~azure.mgmt.search.models.QueryKey] - :raises: :class:`CloudError` - """ - client_request_id = None - if search_management_request_options is not None: - client_request_id = search_management_request_options.client_request_id - - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_search_service.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - if client_request_id is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - deserialized = models.QueryKeyPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.QueryKeyPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_by_search_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listQueryKeys'} - - def delete( - self, resource_group_name, search_service_name, key, search_management_request_options=None, custom_headers=None, raw=False, **operation_config): - """Deletes the specified query key. Unlike admin keys, query keys are not - regenerated. The process for regenerating a query key is to delete and - then recreate it. - - :param resource_group_name: The name of the resource group within the - current subscription. You can obtain this value from the Azure - Resource Manager API or the portal. - :type resource_group_name: str - :param search_service_name: The name of the Azure Search service - associated with the specified resource group. - :type search_service_name: str - :param key: The query key to be deleted. Query keys are identified by - value, not by name. - :type key: str - :param search_management_request_options: Additional parameters for - the operation - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - client_request_id = None - if search_management_request_options is not None: - client_request_id = search_management_request_options.client_request_id - - # Construct URL - url = self.delete.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), - 'key': self._serialize.url("key", key, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - if client_request_id is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str') - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 204, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/deleteQueryKey/{key}'} diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/services_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/services_operations.py deleted file mode 100644 index c89b0d0e364d..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/services_operations.py +++ /dev/null @@ -1,620 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling - -from .. import models - - -class ServicesOperations(object): - """ServicesOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for each request. The current version is 2015-08-19. Constant value: "2015-08-19". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2015-08-19" - - self.config = config - - - def _create_or_update_initial( - self, resource_group_name, search_service_name, service, search_management_request_options=None, custom_headers=None, raw=False, **operation_config): - client_request_id = None - if search_management_request_options is not None: - client_request_id = search_management_request_options.client_request_id - - # Construct URL - url = self.create_or_update.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - if client_request_id is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str') - - # Construct body - body_content = self._serialize.body(service, 'SearchService') - - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('SearchService', response) - if response.status_code == 201: - deserialized = self._deserialize('SearchService', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def create_or_update( - self, resource_group_name, search_service_name, service, search_management_request_options=None, custom_headers=None, raw=False, polling=True, **operation_config): - """Creates or updates a Search service in the given resource group. If the - Search service already exists, all properties will be updated with the - given values. - - :param resource_group_name: The name of the resource group within the - current subscription. You can obtain this value from the Azure - Resource Manager API or the portal. - :type resource_group_name: str - :param search_service_name: The name of the Azure Search service to - create or update. Search service names must only contain lowercase - letters, digits or dashes, cannot use dash as the first two or last - one characters, cannot contain consecutive dashes, and must be between - 2 and 60 characters in length. Search service names must be globally - unique since they are part of the service URI - (https://.search.windows.net). You cannot change the service - name after the service is created. - :type search_service_name: str - :param service: The definition of the Search service to create or - update. - :type service: ~azure.mgmt.search.models.SearchService - :param search_management_request_options: Additional parameters for - the operation - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns SearchService or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.search.models.SearchService] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.search.models.SearchService]] - :raises: :class:`CloudError` - """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - service=service, - search_management_request_options=search_management_request_options, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - deserialized = self._deserialize('SearchService', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}'} - - def update( - self, resource_group_name, search_service_name, service, search_management_request_options=None, custom_headers=None, raw=False, **operation_config): - """Updates an existing Search service in the given resource group. - - :param resource_group_name: The name of the resource group within the - current subscription. You can obtain this value from the Azure - Resource Manager API or the portal. - :type resource_group_name: str - :param search_service_name: The name of the Azure Search service to - update. - :type search_service_name: str - :param service: The definition of the Search service to update. - :type service: ~azure.mgmt.search.models.SearchService - :param search_management_request_options: Additional parameters for - the operation - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SearchService or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.search.models.SearchService or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - client_request_id = None - if search_management_request_options is not None: - client_request_id = search_management_request_options.client_request_id - - # Construct URL - url = self.update.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - if client_request_id is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str') - - # Construct body - body_content = self._serialize.body(service, 'SearchService') - - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('SearchService', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}'} - - def get( - self, resource_group_name, search_service_name, search_management_request_options=None, custom_headers=None, raw=False, **operation_config): - """Gets the Search service with the given name in the given resource - group. - - :param resource_group_name: The name of the resource group within the - current subscription. You can obtain this value from the Azure - Resource Manager API or the portal. - :type resource_group_name: str - :param search_service_name: The name of the Azure Search service - associated with the specified resource group. - :type search_service_name: str - :param search_management_request_options: Additional parameters for - the operation - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SearchService or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.search.models.SearchService or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - client_request_id = None - if search_management_request_options is not None: - client_request_id = search_management_request_options.client_request_id - - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - if client_request_id is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('SearchService', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}'} - - def delete( - self, resource_group_name, search_service_name, search_management_request_options=None, custom_headers=None, raw=False, **operation_config): - """Deletes a Search service in the given resource group, along with its - associated resources. - - :param resource_group_name: The name of the resource group within the - current subscription. You can obtain this value from the Azure - Resource Manager API or the portal. - :type resource_group_name: str - :param search_service_name: The name of the Azure Search service - associated with the specified resource group. - :type search_service_name: str - :param search_management_request_options: Additional parameters for - the operation - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - client_request_id = None - if search_management_request_options is not None: - client_request_id = search_management_request_options.client_request_id - - # Construct URL - url = self.delete.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'searchServiceName': self._serialize.url("search_service_name", search_service_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - if client_request_id is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str') - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 204, 404]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}'} - - def list_by_resource_group( - self, resource_group_name, search_management_request_options=None, custom_headers=None, raw=False, **operation_config): - """Gets a list of all Search services in the given resource group. - - :param resource_group_name: The name of the resource group within the - current subscription. You can obtain this value from the Azure - Resource Manager API or the portal. - :type resource_group_name: str - :param search_management_request_options: Additional parameters for - the operation - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SearchService - :rtype: - ~azure.mgmt.search.models.SearchServicePaged[~azure.mgmt.search.models.SearchService] - :raises: :class:`CloudError` - """ - client_request_id = None - if search_management_request_options is not None: - client_request_id = search_management_request_options.client_request_id - - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - if client_request_id is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - deserialized = models.SearchServicePaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.SearchServicePaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices'} - - def list_by_subscription( - self, search_management_request_options=None, custom_headers=None, raw=False, **operation_config): - """Gets a list of all Search services in the given subscription. - - :param search_management_request_options: Additional parameters for - the operation - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SearchService - :rtype: - ~azure.mgmt.search.models.SearchServicePaged[~azure.mgmt.search.models.SearchService] - :raises: :class:`CloudError` - """ - client_request_id = None - if search_management_request_options is not None: - client_request_id = search_management_request_options.client_request_id - - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - if client_request_id is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - deserialized = models.SearchServicePaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.SearchServicePaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Search/searchServices'} - - def check_name_availability( - self, name, search_management_request_options=None, custom_headers=None, raw=False, **operation_config): - """Checks whether or not the given Search service name is available for - use. Search service names must be globally unique since they are part - of the service URI (https://.search.windows.net). - - :param name: The Search service name to validate. Search service names - must only contain lowercase letters, digits or dashes, cannot use dash - as the first two or last one characters, cannot contain consecutive - dashes, and must be between 2 and 60 characters in length. - :type name: str - :param search_management_request_options: Additional parameters for - the operation - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CheckNameAvailabilityOutput or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.search.models.CheckNameAvailabilityOutput or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - client_request_id = None - if search_management_request_options is not None: - client_request_id = search_management_request_options.client_request_id - check_name_availability_input = models.CheckNameAvailabilityInput(name=name) - - # Construct URL - url = self.check_name_availability.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - if client_request_id is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str') - - # Construct body - body_content = self._serialize.body(check_name_availability_input, 'CheckNameAvailabilityInput') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('CheckNameAvailabilityOutput', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Search/checkNameAvailability'} diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/py.typed b/sdk/search/azure-mgmt-search/azure/mgmt/search/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/search_management_client.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/search_management_client.py deleted file mode 100644 index 9c86581dc538..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/search_management_client.py +++ /dev/null @@ -1,100 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.service_client import SDKClient -from msrest import Serializer, Deserializer -from msrestazure import AzureConfiguration -from .version import VERSION -from .operations.operations import Operations -from .operations.admin_keys_operations import AdminKeysOperations -from .operations.query_keys_operations import QueryKeysOperations -from .operations.services_operations import ServicesOperations -from . import models - - -class SearchManagementClientConfiguration(AzureConfiguration): - """Configuration for SearchManagementClient - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :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. - :type subscription_id: str - :param str base_url: Service URL - """ - - def __init__( - self, credentials, subscription_id, base_url=None): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - if not base_url: - base_url = 'https://management.azure.com' - - super(SearchManagementClientConfiguration, self).__init__(base_url) - - self.add_user_agent('azure-mgmt-search/{}'.format(VERSION)) - self.add_user_agent('Azure-SDK-For-Python') - - self.credentials = credentials - self.subscription_id = subscription_id - - -class SearchManagementClient(SDKClient): - """Client that can be used to manage Azure Search services and API keys. - - :ivar config: Configuration for client. - :vartype config: SearchManagementClientConfiguration - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.search.operations.Operations - :ivar admin_keys: AdminKeys operations - :vartype admin_keys: azure.mgmt.search.operations.AdminKeysOperations - :ivar query_keys: QueryKeys operations - :vartype query_keys: azure.mgmt.search.operations.QueryKeysOperations - :ivar services: Services operations - :vartype services: azure.mgmt.search.operations.ServicesOperations - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :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. - :type subscription_id: str - :param str base_url: Service URL - """ - - def __init__( - self, credentials, subscription_id, base_url=None): - - self.config = SearchManagementClientConfiguration(credentials, subscription_id, base_url) - super(SearchManagementClient, self).__init__(self.config.credentials, self.config) - - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2015-08-19' - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - - self.operations = Operations( - self._client, self.config, self._serialize, self._deserialize) - self.admin_keys = AdminKeysOperations( - self._client, self.config, self._serialize, self._deserialize) - self.query_keys = QueryKeysOperations( - self._client, self.config, self._serialize, self._deserialize) - self.services = ServicesOperations( - self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/search/azure-mgmt-search/setup.py b/sdk/search/azure-mgmt-search/setup.py index a2f5d0ca1a19..c1ee9b3fbcc6 100644 --- a/sdk/search/azure-mgmt-search/setup.py +++ b/sdk/search/azure-mgmt-search/setup.py @@ -36,7 +36,7 @@ pass # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd: +with open(os.path.join(package_folder_path, '_version.py'), 'r') as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) @@ -79,8 +79,8 @@ ]), install_requires=[ 'msrest>=0.5.0', - 'msrestazure>=0.4.32,<2.0.0', 'azure-common~=1.1', + 'azure-mgmt-core>=1.2.0,<2.0.0', ], extras_require={ ":python_version<'3.0'": ['azure-mgmt-nspkg'], diff --git a/sdk/search/azure-mgmt-search/tests/recordings/test_mgmt_search.test_search_admin_keys.yaml b/sdk/search/azure-mgmt-search/tests/recordings/test_mgmt_search.test_search_admin_keys.yaml index cca43b3b5b89..8ab4804016ad 100644 --- a/sdk/search/azure-mgmt-search/tests/recordings/test_mgmt_search.test_search_admin_keys.yaml +++ b/sdk/search/azure-mgmt-search/tests/recordings/test_mgmt_search.test_search_admin_keys.yaml @@ -1,105 +1,152 @@ interactions: - request: - body: '{"location": "westus", "sku": {"name": "free"}, "properties": {"hostingMode": - "default", "replicaCount": 1, "partitionCount": 1}}' + body: '{"location": "westus", "sku": {"name": "free"}, "properties": {"replicaCount": + 1, "partitionCount": 1, "hostingMode": "Default"}}' headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - Connection: [keep-alive] - Content-Length: ['129'] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 - msrest_azure/0.4.6 searchmanagementclient/0.11.0 Azure-SDK-For-Python] - accept-language: [en-US] - x-ms-client-request-id: [fa2a4500-c8a5-11e6-a051-ecb1d756380e] + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '129' + Content-Type: + - application/json + User-Agent: + - azsdk-python-mgmt-search/8.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_admin_keys3f6f0ff0/providers/Microsoft.Search/searchServices/ptvstestquerykeys?api-version=2015-08-19 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_admin_keys3f6f0ff0/providers/Microsoft.Search/searchServices/ptvstestquerykeys?api-version=2020-08-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_admin_keys3f6f0ff0/providers/Microsoft.Search/searchServices/ptvstestquerykeys","name":"ptvstestquerykeys","type":"Microsoft.Search/searchServices","location":"West - US","properties":{"replicaCount":1,"partitionCount":1,"status":"running","statusDetails":null,"provisioningState":"succeeded","hostingMode":"default"},"sku":{"name":"free"}}'} + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_admin_keys3f6f0ff0/providers/Microsoft.Search/searchServices/ptvstestquerykeys","name":"ptvstestquerykeys","type":"Microsoft.Search/searchServices","location":"West + US","properties":{"replicaCount":1,"partitionCount":1,"status":"running","statusDetails":"","provisioningState":"succeeded","hostingMode":"Default","publicNetworkAccess":"Enabled","networkRuleSet":{"ipRules":[],"bypass":"None"},"privateEndpointConnections":[],"sharedPrivateLinkResources":[]},"sku":{"name":"free"}}' headers: - Cache-Control: [no-cache] - Content-Length: ['441'] - Content-Type: [application/json; charset=utf-8] - Date: ['Fri, 23 Dec 2016 00:23:09 GMT'] - ETag: [W/"datetime'2016-12-23T00%3A23%3A10.2711849Z'"] - Expires: ['-1'] - Pragma: [no-cache] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - X-AspNet-Version: [4.0.30319] - elapsed-time: ['1163'] - request-id: [fa2a4500-c8a5-11e6-a051-ecb1d756380e] - x-ms-correlation-request-id: [e73772be-9a67-42b3-92b9-84c65a78f6c2] - x-ms-ratelimit-remaining-subscription-writes: ['1197'] - x-ms-request-id: [fa2a4500-c8a5-11e6-a051-ecb1d756380e] - x-ms-routing-request-id: ['CENTRALUS:20161223T002310Z:e73772be-9a67-42b3-92b9-84c65a78f6c2'] - status: {code: 201, message: Created} + cache-control: + - no-cache + content-length: + - '583' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 27 Oct 2020 09:28:39 GMT + elapsed-time: + - '317' + etag: + - W/"datetime'2020-10-27T09%3A28%3A40.3310359Z'" + expires: + - '-1' + pragma: + - no-cache + request-id: + - cacf6092-1836-11eb-8280-0242ac110007 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK - request: body: null headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - Connection: [keep-alive] - Content-Length: ['0'] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 - msrest_azure/0.4.6 searchmanagementclient/0.11.0 Azure-SDK-For-Python] - accept-language: [en-US] - x-ms-client-request-id: [fc037518-c8a5-11e6-ad6e-ecb1d756380e] + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-mgmt-search/8.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_admin_keys3f6f0ff0/providers/Microsoft.Search/searchServices/ptvstestquerykeys/listAdminKeys?api-version=2015-08-19 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_admin_keys3f6f0ff0/providers/Microsoft.Search/searchServices/ptvstestquerykeys/listAdminKeys?api-version=2020-08-01 response: - body: {string: '{"primaryKey":"01BF7405A5901538C4F0F3DB31B07B73","secondaryKey":"228E0DA6EC5A817DB1A0BB592BF22723"}'} + body: + string: '{"primaryKey":"808D983DDDEAE322A7110E4D1001DFA5","secondaryKey":"8F5BCD895E6569DA478350DC388ED991"}' headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Fri, 23 Dec 2016 00:23:11 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: ['Accept-Encoding,Accept-Encoding'] - X-AspNet-Version: [4.0.30319] - content-length: ['99'] - elapsed-time: ['176'] - request-id: [fc037518-c8a5-11e6-ad6e-ecb1d756380e] - x-ms-correlation-request-id: [d6976bc0-8325-4384-8a80-ff87cba59312] - x-ms-ratelimit-remaining-subscription-writes: ['1199'] - x-ms-request-id: [fc037518-c8a5-11e6-ad6e-ecb1d756380e] - x-ms-routing-request-id: ['CENTRALUS:20161223T002311Z:d6976bc0-8325-4384-8a80-ff87cba59312'] - status: {code: 200, message: OK} + cache-control: + - no-cache + content-length: + - '99' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 27 Oct 2020 09:28:40 GMT + elapsed-time: + - '131' + expires: + - '-1' + pragma: + - no-cache + request-id: + - cc6fd7a6-1836-11eb-8280-0242ac110007 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK - request: body: null headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - Connection: [keep-alive] - Content-Length: ['0'] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 - msrest_azure/0.4.6 searchmanagementclient/0.11.0 Azure-SDK-For-Python] - accept-language: [en-US] - x-ms-client-request-id: [fca6bd10-c8a5-11e6-a35e-ecb1d756380e] + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-mgmt-search/8.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_admin_keys3f6f0ff0/providers/Microsoft.Search/searchServices/ptvstestquerykeys/regenerateAdminKey/primary?api-version=2015-08-19 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_admin_keys3f6f0ff0/providers/Microsoft.Search/searchServices/ptvstestquerykeys/regenerateAdminKey/primary?api-version=2020-08-01 response: - body: {string: '{"primaryKey":"160C118CFA43D8555F3171B6D69F2F25","secondaryKey":"228E0DA6EC5A817DB1A0BB592BF22723"}'} + body: + string: '{"primaryKey":"2E013FD2099C8076974CD75D2F02BA25","secondaryKey":"8F5BCD895E6569DA478350DC388ED991"}' headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Fri, 23 Dec 2016 00:23:11 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: ['Accept-Encoding,Accept-Encoding'] - X-AspNet-Version: [4.0.30319] - content-length: ['99'] - elapsed-time: ['378'] - request-id: [fca6bd10-c8a5-11e6-a35e-ecb1d756380e] - x-ms-correlation-request-id: [de432fee-cbd9-45d7-997e-1c5ed37f477f] - x-ms-ratelimit-remaining-subscription-writes: ['1198'] - x-ms-request-id: [fca6bd10-c8a5-11e6-a35e-ecb1d756380e] - x-ms-routing-request-id: ['CENTRALUS:20161223T002312Z:de432fee-cbd9-45d7-997e-1c5ed37f477f'] - status: {code: 200, message: OK} + cache-control: + - no-cache + content-length: + - '99' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 27 Oct 2020 09:28:41 GMT + elapsed-time: + - '405' + expires: + - '-1' + pragma: + - no-cache + request-id: + - ccb19c72-1836-11eb-8280-0242ac110007 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 200 + message: OK version: 1 diff --git a/sdk/search/azure-mgmt-search/tests/recordings/test_mgmt_search.test_search_query_keys.yaml b/sdk/search/azure-mgmt-search/tests/recordings/test_mgmt_search.test_search_query_keys.yaml index b5b7c5deb7db..184ea9a3c13f 100644 --- a/sdk/search/azure-mgmt-search/tests/recordings/test_mgmt_search.test_search_query_keys.yaml +++ b/sdk/search/azure-mgmt-search/tests/recordings/test_mgmt_search.test_search_query_keys.yaml @@ -1,138 +1,195 @@ interactions: - request: - body: '{"properties": {"hostingMode": "default", "replicaCount": 1, "partitionCount": - 1}, "sku": {"name": "free"}, "location": "westus"}' + body: '{"location": "westus", "sku": {"name": "standard"}, "properties": {"replicaCount": + 1, "partitionCount": 1, "hostingMode": "Default"}}' headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - Connection: [keep-alive] - Content-Length: ['129'] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 - msrest_azure/0.4.6 searchmanagementclient/0.11.0 Azure-SDK-For-Python] - accept-language: [en-US] - x-ms-client-request-id: [8b43ff7e-c8a5-11e6-8570-ecb1d756380e] + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '133' + Content-Type: + - application/json + User-Agent: + - azsdk-python-mgmt-search/8.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_query_keys40e9101d/providers/Microsoft.Search/searchServices/ptvstestquerykeys?api-version=2015-08-19 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_query_keys40e9101d/providers/Microsoft.Search/searchServices/ptvstestquerykeysxxy?api-version=2020-08-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_query_keys40e9101d/providers/Microsoft.Search/searchServices/ptvstestquerykeys","name":"ptvstestquerykeys","type":"Microsoft.Search/searchServices","location":"West - US","properties":{"replicaCount":1,"partitionCount":1,"status":"running","statusDetails":null,"provisioningState":"succeeded","hostingMode":"default"},"sku":{"name":"free"}}'} + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_query_keys40e9101d/providers/Microsoft.Search/searchServices/ptvstestquerykeysxxy","name":"ptvstestquerykeysxxy","type":"Microsoft.Search/searchServices","location":"West + US","properties":{"replicaCount":1,"partitionCount":1,"status":"running","statusDetails":"","provisioningState":"succeeded","hostingMode":"Default","publicNetworkAccess":"Enabled","networkRuleSet":{"ipRules":[],"bypass":"None"},"privateEndpointConnections":[],"sharedPrivateLinkResources":[]},"sku":{"name":"standard"}}' headers: - Cache-Control: [no-cache] - Content-Length: ['441'] - Content-Type: [application/json; charset=utf-8] - Date: ['Fri, 23 Dec 2016 00:20:03 GMT'] - ETag: [W/"datetime'2016-12-23T00%3A20%3A03.7237675Z'"] - Expires: ['-1'] - Pragma: [no-cache] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - X-AspNet-Version: [4.0.30319] - elapsed-time: ['1299'] - request-id: [8b43ff7e-c8a5-11e6-8570-ecb1d756380e] - x-ms-correlation-request-id: [ee4f17f1-9aff-4b09-8652-dc297666f9d3] - x-ms-ratelimit-remaining-subscription-writes: ['1196'] - x-ms-request-id: [8b43ff7e-c8a5-11e6-8570-ecb1d756380e] - x-ms-routing-request-id: ['CENTRALUS:20161223T002004Z:ee4f17f1-9aff-4b09-8652-dc297666f9d3'] - status: {code: 201, message: Created} + cache-control: + - no-cache + content-length: + - '593' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 27 Oct 2020 09:40:56 GMT + elapsed-time: + - '2998' + etag: + - W/"datetime'2020-10-27T09%3A40%3A55.0590301Z'" + expires: + - '-1' + pragma: + - no-cache + request-id: + - 7c76eaf8-1838-11eb-9153-0242ac110007 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 201 + message: Created - request: body: null headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - Connection: [keep-alive] - Content-Length: ['0'] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 - msrest_azure/0.4.6 searchmanagementclient/0.11.0 Azure-SDK-For-Python] - accept-language: [en-US] - x-ms-client-request-id: [8cfe2f86-c8a5-11e6-9100-ecb1d756380e] + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-mgmt-search/8.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_query_keys40e9101d/providers/Microsoft.Search/searchServices/ptvstestquerykeys/createQueryKey/testkey?api-version=2015-08-19 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_query_keys40e9101d/providers/Microsoft.Search/searchServices/ptvstestquerykeysxxy/createQueryKey/testkey?api-version=2020-08-01 response: - body: {string: '{"name":"testkey","key":"AF89A03FF9A6182B6C4BA88E91D1D5EA"}'} + body: + string: '{"name":"testkey","key":"2E46BA4FC84B8DCC2039F4BA329B4B73"}' headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Fri, 23 Dec 2016 00:20:04 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: ['Accept-Encoding,Accept-Encoding'] - X-AspNet-Version: [4.0.30319] - content-length: ['59'] - elapsed-time: ['349'] - request-id: [8cfe2f86-c8a5-11e6-9100-ecb1d756380e] - x-ms-correlation-request-id: [a4820bf9-12f0-4498-bee3-3b40781ac29b] - x-ms-ratelimit-remaining-subscription-writes: ['1199'] - x-ms-request-id: [8cfe2f86-c8a5-11e6-9100-ecb1d756380e] - x-ms-routing-request-id: ['CENTRALUS:20161223T002005Z:a4820bf9-12f0-4498-bee3-3b40781ac29b'] - status: {code: 200, message: OK} + cache-control: + - no-cache + content-length: + - '59' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 27 Oct 2020 09:40:57 GMT + elapsed-time: + - '173' + expires: + - '-1' + pragma: + - no-cache + request-id: + - 8341630e-1838-11eb-9153-0242ac110007 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK - request: body: null headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - Connection: [keep-alive] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 - msrest_azure/0.4.6 searchmanagementclient/0.11.0 Azure-SDK-For-Python] - accept-language: [en-US] - x-ms-client-request-id: [8da5f0f4-c8a5-11e6-a582-ecb1d756380e] - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_query_keys40e9101d/providers/Microsoft.Search/searchServices/ptvstestquerykeys/listQueryKeys?api-version=2015-08-19 + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-mgmt-search/8.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_query_keys40e9101d/providers/Microsoft.Search/searchServices/ptvstestquerykeysxxy/listQueryKeys?api-version=2020-08-01 response: - body: {string: '{"value":[{"name":null,"key":"F67EDCEFE7EAFC8ADE86A8AE40236A81"},{"name":"testkey","key":"AF89A03FF9A6182B6C4BA88E91D1D5EA"}],"nextLink":null}'} + body: + string: '{"value":[{"name":null,"key":"69684B14BE2E6358027B2B0FC97B2158"},{"name":"testkey","key":"2E46BA4FC84B8DCC2039F4BA329B4B73"}],"nextLink":null}' headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Fri, 23 Dec 2016 00:20:06 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: ['Accept-Encoding,Accept-Encoding'] - X-AspNet-Version: [4.0.30319] - content-length: ['142'] - elapsed-time: ['152'] - request-id: [8da5f0f4-c8a5-11e6-a582-ecb1d756380e] - x-ms-correlation-request-id: [65bacbd1-d6b5-48d2-a07a-22ac84b4790e] - x-ms-ratelimit-remaining-subscription-reads: ['14998'] - x-ms-request-id: [8da5f0f4-c8a5-11e6-a582-ecb1d756380e] - x-ms-routing-request-id: ['CENTRALUS:20161223T002006Z:65bacbd1-d6b5-48d2-a07a-22ac84b4790e'] - status: {code: 200, message: OK} + cache-control: + - no-cache + content-length: + - '142' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 27 Oct 2020 09:40:57 GMT + elapsed-time: + - '185' + expires: + - '-1' + pragma: + - no-cache + request-id: + - 838a7bf2-1838-11eb-9153-0242ac110007 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 200 + message: OK - request: body: null headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - Connection: [keep-alive] - Content-Length: ['0'] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 - msrest_azure/0.4.6 searchmanagementclient/0.11.0 Azure-SDK-For-Python] - accept-language: [en-US] - x-ms-client-request-id: [8e2a3d62-c8a5-11e6-bdf9-ecb1d756380e] + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-mgmt-search/8.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_query_keys40e9101d/providers/Microsoft.Search/searchServices/ptvstestquerykeys/deleteQueryKey/testkey?api-version=2015-08-19 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_query_keys40e9101d/providers/Microsoft.Search/searchServices/ptvstestquerykeysxxy/deleteQueryKey/testkey?api-version=2020-08-01 response: - body: {string: '{"error":{"code":"Unknown","message":"This API key does not exist - for service ''ptvstestquerykeys''. RequestId: 8e2a3d62-c8a5-11e6-bdf9-ecb1d756380e","target":null,"details":null}}'} + body: + string: '{"error":{"code":"Unknown","message":"This API key does not exist for + service ''ptvstestquerykeysxxy''. RequestId: 83d510ae-1838-11eb-9153-0242ac110007","target":null,"details":null}}' headers: - Cache-Control: [no-cache] - Content-Language: [en] - Content-Length: ['178'] - Content-Type: [application/json; charset=utf-8] - Date: ['Fri, 23 Dec 2016 00:20:06 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - X-AspNet-Version: [4.0.30319] - elapsed-time: ['199'] - request-id: [8e2a3d62-c8a5-11e6-bdf9-ecb1d756380e] - x-ms-correlation-request-id: [b1665ad3-672b-4b19-beec-a7992634d4c4] - x-ms-ratelimit-remaining-subscription-writes: ['1197'] - x-ms-request-id: [8e2a3d62-c8a5-11e6-bdf9-ecb1d756380e] - x-ms-routing-request-id: ['CENTRALUS:20161223T002007Z:b1665ad3-672b-4b19-beec-a7992634d4c4'] - status: {code: 404, message: Not Found} + cache-control: + - no-cache + content-language: + - en + content-length: + - '181' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 27 Oct 2020 09:40:58 GMT + elapsed-time: + - '177' + expires: + - '-1' + pragma: + - no-cache + request-id: + - 83d510ae-1838-11eb-9153-0242ac110007 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 404 + message: Not Found version: 1 diff --git a/sdk/search/azure-mgmt-search/tests/recordings/test_mgmt_search.test_search_services.yaml b/sdk/search/azure-mgmt-search/tests/recordings/test_mgmt_search.test_search_services.yaml index 3bfdeb8dc2bc..799169e356e8 100644 --- a/sdk/search/azure-mgmt-search/tests/recordings/test_mgmt_search.test_search_services.yaml +++ b/sdk/search/azure-mgmt-search/tests/recordings/test_mgmt_search.test_search_services.yaml @@ -2,204 +2,285 @@ interactions: - request: body: '{"name": "ptvstestsearch", "type": "searchServices"}' headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - Connection: [keep-alive] - Content-Length: ['52'] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 - msrest_azure/0.4.6 searchmanagementclient/0.11.0 Azure-SDK-For-Python] - accept-language: [en-US] - x-ms-client-request-id: [2511dcd8-c8a4-11e6-a7ba-ecb1d756380e] + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '52' + Content-Type: + - application/json + User-Agent: + - azsdk-python-mgmt-search/8.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Search/checkNameAvailability?api-version=2015-08-19 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Search/checkNameAvailability?api-version=2020-08-01 response: - body: {string: '{"nameAvailable":true,"reason":null,"message":null}'} + body: + string: '{"nameAvailable":true,"reason":null,"message":null}' headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Fri, 23 Dec 2016 00:10:00 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: ['Accept-Encoding,Accept-Encoding'] - X-AspNet-Version: [4.0.30319] - content-length: ['51'] - elapsed-time: ['8'] - request-id: [2511dcd8-c8a4-11e6-a7ba-ecb1d756380e] - x-ms-correlation-request-id: [b2ebca8b-5c06-4a2b-9139-a3116cec7b16] - x-ms-ratelimit-remaining-subscription-writes: ['1196'] - x-ms-request-id: [2511dcd8-c8a4-11e6-a7ba-ecb1d756380e] - x-ms-routing-request-id: ['CENTRALUS:20161223T001000Z:b2ebca8b-5c06-4a2b-9139-a3116cec7b16'] - status: {code: 200, message: OK} + cache-control: + - no-cache + content-length: + - '51' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 27 Oct 2020 09:41:16 GMT + elapsed-time: + - '130' + expires: + - '-1' + pragma: + - no-cache + request-id: + - 8e3a7fca-1838-11eb-8044-0242ac110007 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 200 + message: OK - request: - body: '{"sku": {"name": "free"}, "location": "westus", "properties": {"replicaCount": - 1, "hostingMode": "default", "partitionCount": 1}}' + body: '{"location": "westus", "sku": {"name": "standard"}, "properties": {"replicaCount": + 1, "partitionCount": 1, "hostingMode": "Default"}}' headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - Connection: [keep-alive] - Content-Length: ['129'] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 - msrest_azure/0.4.6 searchmanagementclient/0.11.0 Azure-SDK-For-Python] - accept-language: [en-US] - x-ms-client-request-id: [25679dda-c8a4-11e6-bf37-ecb1d756380e] + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '133' + Content-Type: + - application/json + User-Agent: + - azsdk-python-mgmt-search/8.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_services20f20f30/providers/Microsoft.Search/searchServices/ptvstestsearch?api-version=2015-08-19 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_services20f20f30/providers/Microsoft.Search/searchServices/ptvstestsearch?api-version=2020-08-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_services20f20f30/providers/Microsoft.Search/searchServices/ptvstestsearch","name":"ptvstestsearch","type":"Microsoft.Search/searchServices","location":"West - US","properties":{"replicaCount":1,"partitionCount":1,"status":"running","statusDetails":null,"provisioningState":"succeeded","hostingMode":"default"},"sku":{"name":"free"}}'} + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_services20f20f30/providers/Microsoft.Search/searchServices/ptvstestsearch","name":"ptvstestsearch","type":"Microsoft.Search/searchServices","location":"West + US","properties":{"replicaCount":1,"partitionCount":1,"status":"running","statusDetails":"","provisioningState":"succeeded","hostingMode":"Default","publicNetworkAccess":"Enabled","networkRuleSet":{"ipRules":[],"bypass":"None"},"privateEndpointConnections":[],"sharedPrivateLinkResources":[]},"sku":{"name":"standard"}}' headers: - Cache-Control: [no-cache] - Content-Length: ['433'] - Content-Type: [application/json; charset=utf-8] - Date: ['Fri, 23 Dec 2016 00:10:03 GMT'] - ETag: [W/"datetime'2016-12-23T00%3A10%3A03.8006148Z'"] - Expires: ['-1'] - Pragma: [no-cache] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - X-AspNet-Version: [4.0.30319] - elapsed-time: ['1540'] - request-id: [25679dda-c8a4-11e6-bf37-ecb1d756380e] - x-ms-correlation-request-id: [14245062-ac08-464b-a702-5fdee9449cde] - x-ms-ratelimit-remaining-subscription-writes: ['1198'] - x-ms-request-id: [25679dda-c8a4-11e6-bf37-ecb1d756380e] - x-ms-routing-request-id: ['CENTRALUS:20161223T001003Z:14245062-ac08-464b-a702-5fdee9449cde'] - status: {code: 201, message: Created} + cache-control: + - no-cache + content-length: + - '579' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 27 Oct 2020 09:41:24 GMT + elapsed-time: + - '2065' + etag: + - W/"datetime'2020-10-27T09%3A41%3A23.5184327Z'" + expires: + - '-1' + pragma: + - no-cache + request-id: + - 8f733e2c-1838-11eb-8044-0242ac110007 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + status: + code: 201 + message: Created - request: body: '{"name": "ptvstestsearch", "type": "searchServices"}' headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - Connection: [keep-alive] - Content-Length: ['52'] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 - msrest_azure/0.4.6 searchmanagementclient/0.11.0 Azure-SDK-For-Python] - accept-language: [en-US] - x-ms-client-request-id: [2742297e-c8a4-11e6-8276-ecb1d756380e] + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '52' + Content-Type: + - application/json + User-Agent: + - azsdk-python-mgmt-search/8.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Search/checkNameAvailability?api-version=2015-08-19 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Search/checkNameAvailability?api-version=2020-08-01 response: - body: {string: '{"nameAvailable":false,"reason":"AlreadyExists","message":null}'} + body: + string: '{"nameAvailable":false,"reason":"AlreadyExists","message":null}' headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Fri, 23 Dec 2016 00:10:04 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: ['Accept-Encoding,Accept-Encoding'] - X-AspNet-Version: [4.0.30319] - content-length: ['63'] - elapsed-time: ['10'] - request-id: [2742297e-c8a4-11e6-8276-ecb1d756380e] - x-ms-correlation-request-id: [ef856114-9972-4396-a409-d6eee39b2e68] - x-ms-ratelimit-remaining-subscription-writes: ['1197'] - x-ms-request-id: [2742297e-c8a4-11e6-8276-ecb1d756380e] - x-ms-routing-request-id: ['CENTRALUS:20161223T001004Z:ef856114-9972-4396-a409-d6eee39b2e68'] - status: {code: 200, message: OK} + cache-control: + - no-cache + content-length: + - '63' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 27 Oct 2020 09:41:24 GMT + elapsed-time: + - '63' + expires: + - '-1' + pragma: + - no-cache + request-id: + - 943574e8-1838-11eb-8044-0242ac110007 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + status: + code: 200 + message: OK - request: body: null headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - Connection: [keep-alive] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 - msrest_azure/0.4.6 searchmanagementclient/0.11.0 Azure-SDK-For-Python] - accept-language: [en-US] - x-ms-client-request-id: [279d68e2-c8a4-11e6-84fb-ecb1d756380e] + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-mgmt-search/8.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_services20f20f30/providers/Microsoft.Search/searchServices/ptvstestsearch?api-version=2015-08-19 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_services20f20f30/providers/Microsoft.Search/searchServices/ptvstestsearch?api-version=2020-08-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_services20f20f30/providers/Microsoft.Search/searchServices/ptvstestsearch","name":"ptvstestsearch","type":"Microsoft.Search/searchServices","location":"West - US","properties":{"replicaCount":1,"partitionCount":1,"status":"running","statusDetails":null,"provisioningState":"succeeded","hostingMode":"default"},"sku":{"name":"free"}}'} + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_services20f20f30/providers/Microsoft.Search/searchServices/ptvstestsearch","name":"ptvstestsearch","type":"Microsoft.Search/searchServices","location":"West + US","properties":{"replicaCount":1,"partitionCount":1,"status":"running","statusDetails":"","provisioningState":"succeeded","hostingMode":"Default","publicNetworkAccess":"Enabled","networkRuleSet":{"ipRules":[],"bypass":"None"},"privateEndpointConnections":[],"sharedPrivateLinkResources":[]},"sku":{"name":"standard"}}' headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Fri, 23 Dec 2016 00:10:04 GMT'] - ETag: [W/"datetime'2016-12-23T00%3A10%3A03.8006148Z'"] - Expires: ['-1'] - Pragma: [no-cache] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: ['Accept-Encoding,Accept-Encoding'] - X-AspNet-Version: [4.0.30319] - content-length: ['433'] - elapsed-time: ['143'] - request-id: [279d68e2-c8a4-11e6-84fb-ecb1d756380e] - x-ms-correlation-request-id: [4def32c7-e087-4cdc-9756-39d882490106] - x-ms-ratelimit-remaining-subscription-reads: ['14999'] - x-ms-request-id: [279d68e2-c8a4-11e6-84fb-ecb1d756380e] - x-ms-routing-request-id: ['CENTRALUS:20161223T001005Z:4def32c7-e087-4cdc-9756-39d882490106'] - status: {code: 200, message: OK} + cache-control: + - no-cache + content-length: + - '579' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 27 Oct 2020 09:41:25 GMT + elapsed-time: + - '165' + etag: + - W/"datetime'2020-10-27T09%3A41%3A23.5184327Z'" + expires: + - '-1' + pragma: + - no-cache + request-id: + - 946c49b4-1838-11eb-8044-0242ac110007 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK - request: body: null headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - Connection: [keep-alive] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 - msrest_azure/0.4.6 searchmanagementclient/0.11.0 Azure-SDK-For-Python] - accept-language: [en-US] - x-ms-client-request-id: [281557ae-c8a4-11e6-a504-ecb1d756380e] + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-mgmt-search/8.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_services20f20f30/providers/Microsoft.Search/searchServices?api-version=2015-08-19 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_services20f20f30/providers/Microsoft.Search/searchServices?api-version=2020-08-01 response: - body: {string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_services20f20f30/providers/Microsoft.Search/searchServices/ptvstestsearch","name":"ptvstestsearch","type":"Microsoft.Search/searchServices","location":"West - US","properties":{"replicaCount":1,"partitionCount":1,"status":"running","statusDetails":null,"provisioningState":"succeeded","hostingMode":"default","ETag":"W/\"datetime''2016-12-23T00%3A10%3A03.8006148Z''\""},"sku":{"name":"free"}}],"nextLink":null}'} + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_services20f20f30/providers/Microsoft.Search/searchServices/ptvstestsearch","name":"ptvstestsearch","type":"Microsoft.Search/searchServices","location":"West + US","properties":{"replicaCount":1,"partitionCount":1,"status":"running","statusDetails":"","provisioningState":"succeeded","hostingMode":"Default","publicNetworkAccess":"Enabled","networkRuleSet":{"ipRules":[],"bypass":"None"},"privateEndpointConnections":[],"sharedPrivateLinkResources":[],"eTag":"W/\"datetime''2020-10-27T09%3A41%3A23.5184327Z''\""},"sku":{"name":"standard"}}],"nextLink":null}' headers: - Cache-Control: [no-cache] - Content-Type: [application/json; charset=utf-8] - Date: ['Fri, 23 Dec 2016 00:10:06 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: ['Accept-Encoding,Accept-Encoding'] - X-AspNet-Version: [4.0.30319] - content-length: ['519'] - elapsed-time: ['96'] - request-id: [281557ae-c8a4-11e6-a504-ecb1d756380e] - x-ms-correlation-request-id: [50a32d8a-d220-4ca3-b171-65a1bdd0b990] - x-ms-ratelimit-remaining-subscription-reads: ['14999'] - x-ms-request-id: [281557ae-c8a4-11e6-a504-ecb1d756380e] - x-ms-routing-request-id: ['CENTRALUS:20161223T001006Z:50a32d8a-d220-4ca3-b171-65a1bdd0b990'] - status: {code: 200, message: OK} + cache-control: + - no-cache + content-length: + - '665' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 27 Oct 2020 09:41:25 GMT + elapsed-time: + - '169' + expires: + - '-1' + pragma: + - no-cache + request-id: + - 94ae98a0-1838-11eb-8044-0242ac110007 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK - request: body: null headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - Connection: [keep-alive] - Content-Length: ['0'] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.12.1 msrest/0.4.4 - msrest_azure/0.4.6 searchmanagementclient/0.11.0 Azure-SDK-For-Python] - accept-language: [en-US] - x-ms-client-request-id: [28802758-c8a4-11e6-8db3-ecb1d756380e] + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-mgmt-search/8.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_services20f20f30/providers/Microsoft.Search/searchServices/ptvstestsearch?api-version=2015-08-19 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_search_test_search_services20f20f30/providers/Microsoft.Search/searchServices/ptvstestsearch?api-version=2020-08-01 response: - body: {string: ''} + body: + string: '' headers: - Cache-Control: [no-cache] - Content-Length: ['0'] - Date: ['Fri, 23 Dec 2016 00:10:06 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - X-AspNet-Version: [4.0.30319] - elapsed-time: ['310'] - request-id: [28802758-c8a4-11e6-8db3-ecb1d756380e] - x-ms-correlation-request-id: [b9f61e51-53cc-4ebc-9e9c-ff5b845e0c74] - x-ms-ratelimit-remaining-subscription-writes: ['1198'] - x-ms-request-id: [28802758-c8a4-11e6-8db3-ecb1d756380e] - x-ms-routing-request-id: ['CENTRALUS:20161223T001007Z:b9f61e51-53cc-4ebc-9e9c-ff5b845e0c74'] - status: {code: 200, message: OK} + cache-control: + - no-cache + content-length: + - '0' + date: + - Tue, 27 Oct 2020 09:41:31 GMT + elapsed-time: + - '1021' + expires: + - '-1' + pragma: + - no-cache + request-id: + - 94f82920-1838-11eb-8044-0242ac110007 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 200 + message: OK version: 1 diff --git a/sdk/search/azure-mgmt-search/tests/test_mgmt_search.py b/sdk/search/azure-mgmt-search/tests/test_mgmt_search.py index d07827b81316..ad978c1ee98b 100644 --- a/sdk/search/azure-mgmt-search/tests/test_mgmt_search.py +++ b/sdk/search/azure-mgmt-search/tests/test_mgmt_search.py @@ -26,7 +26,7 @@ def test_search_services(self, resource_group, location): availability = self.client.services.check_name_availability(account_name) self.assertTrue(availability.is_name_available) - service = self.client.services.create_or_update( + service = self.client.services.begin_create_or_update( resource_group.name, account_name, { @@ -35,7 +35,7 @@ def test_search_services(self, resource_group, location): 'partition_count': 1, 'hosting_mode': 'Default', 'sku': { - 'name': 'free' + 'name': 'standard' } } ).result() @@ -61,10 +61,10 @@ def test_search_services(self, resource_group, location): @ResourceGroupPreparer() def test_search_query_keys(self, resource_group, location): - account_name = 'ptvstestquerykeys' + account_name = 'ptvstestquerykeysxxy' key_name = 'testkey' - service = self.client.services.create_or_update( + service = self.client.services.begin_create_or_update( resource_group.name, account_name, { @@ -73,10 +73,10 @@ def test_search_query_keys(self, resource_group, location): 'partition_count': 1, 'hosting_mode': 'Default', 'sku': { - 'name': 'free' + 'name': 'standard' } } - ) + ).result() key = self.client.query_keys.create( resource_group.name, @@ -103,7 +103,7 @@ def test_search_query_keys(self, resource_group, location): def test_search_admin_keys(self, resource_group, location): account_name = 'ptvstestquerykeys' - service = self.client.services.create_or_update( + service = self.client.services.begin_create_or_update( resource_group.name, account_name, {