From a76fd5efb60147f1af8560ee0016956e1231b637 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 10 Jul 2018 11:18:47 -0700 Subject: [PATCH 1/5] Generated from 93a610bee8cf78c96ff98829a41aa72328208230 (#2897) Azure Search: Removing redundant commas --- .../azure/mgmt/search/models/__init__.py | 3 ++ .../azure/mgmt/search/models/identity.py | 48 +++++++++++++++++++ .../azure/mgmt/search/models/identity_py3.py | 48 +++++++++++++++++++ .../azure/mgmt/search/models/resource.py | 4 ++ .../azure/mgmt/search/models/resource_py3.py | 6 ++- .../mgmt/search/models/search_service.py | 3 ++ .../mgmt/search/models/search_service_py3.py | 7 ++- .../azure/mgmt/search/version.py | 2 +- 8 files changed, 117 insertions(+), 4 deletions(-) create mode 100644 azure-mgmt-search/azure/mgmt/search/models/identity.py create mode 100644 azure-mgmt-search/azure/mgmt/search/models/identity_py3.py diff --git a/azure-mgmt-search/azure/mgmt/search/models/__init__.py b/azure-mgmt-search/azure/mgmt/search/models/__init__.py index 1fa43c85e74e..1ce1f9f90117 100644 --- a/azure-mgmt-search/azure/mgmt/search/models/__init__.py +++ b/azure-mgmt-search/azure/mgmt/search/models/__init__.py @@ -16,6 +16,7 @@ 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 @@ -27,6 +28,7 @@ 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 @@ -50,6 +52,7 @@ 'QueryKey', 'Sku', 'SearchService', + 'Identity', 'Resource', 'OperationDisplay', 'Operation', diff --git a/azure-mgmt-search/azure/mgmt/search/models/identity.py b/azure-mgmt-search/azure/mgmt/search/models/identity.py new file mode 100644 index 000000000000..f526b986fc70 --- /dev/null +++ b/azure-mgmt-search/azure/mgmt/search/models/identity.py @@ -0,0 +1,48 @@ +# 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 + :ivar type: Required. The identity type. Default value: "SystemAssigned" . + :vartype type: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + 'type': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + type = "SystemAssigned" + + def __init__(self, **kwargs): + super(Identity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None diff --git a/azure-mgmt-search/azure/mgmt/search/models/identity_py3.py b/azure-mgmt-search/azure/mgmt/search/models/identity_py3.py new file mode 100644 index 000000000000..22d25fdd85b7 --- /dev/null +++ b/azure-mgmt-search/azure/mgmt/search/models/identity_py3.py @@ -0,0 +1,48 @@ +# 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 + :ivar type: Required. The identity type. Default value: "SystemAssigned" . + :vartype type: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + 'type': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + type = "SystemAssigned" + + def __init__(self, **kwargs) -> None: + super(Identity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None diff --git a/azure-mgmt-search/azure/mgmt/search/models/resource.py b/azure-mgmt-search/azure/mgmt/search/models/resource.py index 718a54f2e59b..8dc5dd8833f9 100644 --- a/azure-mgmt-search/azure/mgmt/search/models/resource.py +++ b/azure-mgmt-search/azure/mgmt/search/models/resource.py @@ -32,6 +32,8 @@ class Resource(Model): :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 = { @@ -46,6 +48,7 @@ class Resource(Model): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, } def __init__(self, **kwargs): @@ -55,3 +58,4 @@ def __init__(self, **kwargs): self.type = None self.location = kwargs.get('location', None) self.tags = kwargs.get('tags', None) + self.identity = kwargs.get('identity', None) diff --git a/azure-mgmt-search/azure/mgmt/search/models/resource_py3.py b/azure-mgmt-search/azure/mgmt/search/models/resource_py3.py index 0f2e04e0d9cc..752e7a2cbbb9 100644 --- a/azure-mgmt-search/azure/mgmt/search/models/resource_py3.py +++ b/azure-mgmt-search/azure/mgmt/search/models/resource_py3.py @@ -32,6 +32,8 @@ class Resource(Model): :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 = { @@ -46,12 +48,14 @@ class Resource(Model): '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, **kwargs) -> None: + 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/azure-mgmt-search/azure/mgmt/search/models/search_service.py b/azure-mgmt-search/azure/mgmt/search/models/search_service.py index 077847e78c05..6bd3de6791de 100644 --- a/azure-mgmt-search/azure/mgmt/search/models/search_service.py +++ b/azure-mgmt-search/azure/mgmt/search/models/search_service.py @@ -32,6 +32,8 @@ class SearchService(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 . @@ -101,6 +103,7 @@ class SearchService(Resource): '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'}, diff --git a/azure-mgmt-search/azure/mgmt/search/models/search_service_py3.py b/azure-mgmt-search/azure/mgmt/search/models/search_service_py3.py index a0e3dd69d375..823afff5b9a5 100644 --- a/azure-mgmt-search/azure/mgmt/search/models/search_service_py3.py +++ b/azure-mgmt-search/azure/mgmt/search/models/search_service_py3.py @@ -32,6 +32,8 @@ class SearchService(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 . @@ -101,6 +103,7 @@ class SearchService(Resource): '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'}, @@ -110,8 +113,8 @@ class SearchService(Resource): 'sku': {'key': 'sku', 'type': 'Sku'}, } - def __init__(self, *, location: str=None, tags=None, replica_count: int=1, partition_count: int=1, hosting_mode="default", sku=None, **kwargs) -> None: - super(SearchService, self).__init__(location=location, tags=tags, **kwargs) + 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 diff --git a/azure-mgmt-search/azure/mgmt/search/version.py b/azure-mgmt-search/azure/mgmt/search/version.py index 53c4c7ea05e8..373526c862b8 100644 --- a/azure-mgmt-search/azure/mgmt/search/version.py +++ b/azure-mgmt-search/azure/mgmt/search/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "2015-08-19" From bfd58fdf30a9e8ca61c1be13c315dbb237680616 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 4 Dec 2018 09:02:34 -0800 Subject: [PATCH 2/5] [AutoPR search/resource-manager] typo: search/resource-manager/Microsoft.Search (#3988) * Generated from 95144350accb257e537fb7af4cf472c7253670f0 typo: search/resource-manager/Microsoft.Search - programatically -> programmatically - Trim trailing space * Packaging update of azure-mgmt-search --- azure-mgmt-search/MANIFEST.in | 4 +- azure-mgmt-search/README.rst | 8 +-- azure-mgmt-search/azure/__init__.py | 2 +- azure-mgmt-search/azure/mgmt/__init__.py | 2 +- .../operations/admin_keys_operations.py | 12 ++--- .../mgmt/search/operations/operations.py | 7 ++- .../operations/query_keys_operations.py | 18 +++---- .../search/operations/services_operations.py | 36 ++++++------- azure-mgmt-search/azure_bdist_wheel.py | 54 ------------------- azure-mgmt-search/sdk_packaging.toml | 8 +++ azure-mgmt-search/setup.cfg | 1 - azure-mgmt-search/setup.py | 23 ++++---- 12 files changed, 64 insertions(+), 111 deletions(-) delete mode 100644 azure-mgmt-search/azure_bdist_wheel.py create mode 100644 azure-mgmt-search/sdk_packaging.toml diff --git a/azure-mgmt-search/MANIFEST.in b/azure-mgmt-search/MANIFEST.in index 9ecaeb15de50..6ceb27f7a96e 100644 --- a/azure-mgmt-search/MANIFEST.in +++ b/azure-mgmt-search/MANIFEST.in @@ -1,2 +1,4 @@ include *.rst -include azure_bdist_wheel.py \ No newline at end of file +include azure/__init__.py +include azure/mgmt/__init__.py + diff --git a/azure-mgmt-search/README.rst b/azure-mgmt-search/README.rst index 20f634c32590..45de4e6b43dd 100644 --- a/azure-mgmt-search/README.rst +++ b/azure-mgmt-search/README.rst @@ -1,12 +1,12 @@ Microsoft Azure SDK for Python ============================== -This is the Microsoft Azure Search Management Client Library. +This is the Microsoft Azure MyService Management Client Library. Azure Resource Manager (ARM) is the next generation of management APIs that replace the old Azure Service Management (ASM). -This package has been tested with Python 2.7, 3.4, 3.5 and 3.6. +This package has been tested with Python 2.7, 3.4, 3.5, 3.6 and 3.7. For the older Azure Service Management (ASM) libraries, see `azure-servicemanagement-legacy `__ library. @@ -36,8 +36,8 @@ If you see azure==0.11.0 (or any version below 1.0), uninstall it first: Usage ===== -For code examples, see `Search Management -`__ +For code examples, see `MyService Management +`__ on docs.microsoft.com. diff --git a/azure-mgmt-search/azure/__init__.py b/azure-mgmt-search/azure/__init__.py index 849489fca33c..0260537a02bb 100644 --- a/azure-mgmt-search/azure/__init__.py +++ b/azure-mgmt-search/azure/__init__.py @@ -1 +1 @@ -__import__('pkg_resources').declare_namespace(__name__) +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/azure-mgmt-search/azure/mgmt/__init__.py b/azure-mgmt-search/azure/mgmt/__init__.py index 849489fca33c..0260537a02bb 100644 --- a/azure-mgmt-search/azure/mgmt/__init__.py +++ b/azure-mgmt-search/azure/mgmt/__init__.py @@ -1 +1 @@ -__import__('pkg_resources').declare_namespace(__name__) +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/azure-mgmt-search/azure/mgmt/search/operations/admin_keys_operations.py b/azure-mgmt-search/azure/mgmt/search/operations/admin_keys_operations.py index da5e9acb21bc..7887d302f3d4 100644 --- a/azure-mgmt-search/azure/mgmt/search/operations/admin_keys_operations.py +++ b/azure-mgmt-search/azure/mgmt/search/operations/admin_keys_operations.py @@ -82,7 +82,7 @@ def get( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -93,8 +93,8 @@ def get( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) @@ -163,7 +163,7 @@ def regenerate( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -174,8 +174,8 @@ def regenerate( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) diff --git a/azure-mgmt-search/azure/mgmt/search/operations/operations.py b/azure-mgmt-search/azure/mgmt/search/operations/operations.py index 5a35bf95f5d8..c83587eafb24 100644 --- a/azure-mgmt-search/azure/mgmt/search/operations/operations.py +++ b/azure-mgmt-search/azure/mgmt/search/operations/operations.py @@ -68,7 +68,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -77,9 +77,8 @@ def internal_paging(next_link=None, raw=False): 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) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) + 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) diff --git a/azure-mgmt-search/azure/mgmt/search/operations/query_keys_operations.py b/azure-mgmt-search/azure/mgmt/search/operations/query_keys_operations.py index e0ce209493e1..8fb9e29e0309 100644 --- a/azure-mgmt-search/azure/mgmt/search/operations/query_keys_operations.py +++ b/azure-mgmt-search/azure/mgmt/search/operations/query_keys_operations.py @@ -85,7 +85,7 @@ def create( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -96,8 +96,8 @@ def create( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) @@ -167,7 +167,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -178,9 +178,8 @@ def internal_paging(next_link=None, raw=False): 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) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) + 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) @@ -249,7 +248,6 @@ def delete( # Construct headers header_parameters = {} - 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: @@ -260,8 +258,8 @@ def delete( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) diff --git a/azure-mgmt-search/azure/mgmt/search/operations/services_operations.py b/azure-mgmt-search/azure/mgmt/search/operations/services_operations.py index 9a372a7c9c16..d079d72e9d9f 100644 --- a/azure-mgmt-search/azure/mgmt/search/operations/services_operations.py +++ b/azure-mgmt-search/azure/mgmt/search/operations/services_operations.py @@ -61,6 +61,7 @@ def _create_or_update_initial( # 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()) @@ -75,9 +76,8 @@ def _create_or_update_initial( body_content = self._serialize.body(service, 'SearchService') # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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) @@ -210,6 +210,7 @@ def update( # 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()) @@ -224,9 +225,8 @@ def update( body_content = self._serialize.body(service, 'SearchService') # Construct and send request - request = self._client.patch(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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) @@ -290,7 +290,7 @@ def get( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -301,8 +301,8 @@ def get( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) @@ -365,7 +365,6 @@ def delete( # Construct headers header_parameters = {} - 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: @@ -376,8 +375,8 @@ def delete( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) @@ -436,7 +435,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -447,9 +446,8 @@ def internal_paging(next_link=None, raw=False): 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) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) + 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) @@ -512,6 +510,7 @@ def check_name_availability( # 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()) @@ -526,9 +525,8 @@ def check_name_availability( body_content = self._serialize.body(check_name_availability_input, 'CheckNameAvailabilityInput') # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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) diff --git a/azure-mgmt-search/azure_bdist_wheel.py b/azure-mgmt-search/azure_bdist_wheel.py deleted file mode 100644 index 8a81d1b61775..000000000000 --- a/azure-mgmt-search/azure_bdist_wheel.py +++ /dev/null @@ -1,54 +0,0 @@ -#------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -#-------------------------------------------------------------------------- - -from distutils import log as logger -import os.path - -from wheel.bdist_wheel import bdist_wheel -class azure_bdist_wheel(bdist_wheel): - """The purpose of this class is to build wheel a little differently than the sdist, - without requiring to build the wheel from the sdist (i.e. you can build the wheel - directly from source). - """ - - description = "Create an Azure wheel distribution" - - user_options = bdist_wheel.user_options + \ - [('azure-namespace-package=', None, - "Name of the deepest nspkg used")] - - def initialize_options(self): - bdist_wheel.initialize_options(self) - self.azure_namespace_package = None - - def finalize_options(self): - bdist_wheel.finalize_options(self) - if self.azure_namespace_package and not self.azure_namespace_package.endswith("-nspkg"): - raise ValueError("azure_namespace_package must finish by -nspkg") - - def run(self): - if not self.distribution.install_requires: - self.distribution.install_requires = [] - self.distribution.install_requires.append( - "{}>=2.0.0".format(self.azure_namespace_package)) - bdist_wheel.run(self) - - def write_record(self, bdist_dir, distinfo_dir): - if self.azure_namespace_package: - # Split and remove last part, assuming it's "nspkg" - subparts = self.azure_namespace_package.split('-')[0:-1] - folder_with_init = [os.path.join(*subparts[0:i+1]) for i in range(len(subparts))] - for azure_sub_package in folder_with_init: - init_file = os.path.join(bdist_dir, azure_sub_package, '__init__.py') - if os.path.isfile(init_file): - logger.info("manually remove {} while building the wheel".format(init_file)) - os.remove(init_file) - else: - raise ValueError("Unable to find {}. Are you sure of your namespace package?".format(init_file)) - bdist_wheel.write_record(self, bdist_dir, distinfo_dir) -cmdclass = { - 'bdist_wheel': azure_bdist_wheel, -} diff --git a/azure-mgmt-search/sdk_packaging.toml b/azure-mgmt-search/sdk_packaging.toml new file mode 100644 index 000000000000..d4bdf4677206 --- /dev/null +++ b/azure-mgmt-search/sdk_packaging.toml @@ -0,0 +1,8 @@ +[packaging] +package_name = "azure-mgmt-search" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = true diff --git a/azure-mgmt-search/setup.cfg b/azure-mgmt-search/setup.cfg index 856f4164982c..3c6e79cf31da 100644 --- a/azure-mgmt-search/setup.cfg +++ b/azure-mgmt-search/setup.cfg @@ -1,3 +1,2 @@ [bdist_wheel] universal=1 -azure-namespace-package=azure-mgmt-nspkg \ No newline at end of file diff --git a/azure-mgmt-search/setup.py b/azure-mgmt-search/setup.py index d9147216639b..d70a69b4a7e5 100644 --- a/azure-mgmt-search/setup.py +++ b/azure-mgmt-search/setup.py @@ -10,16 +10,10 @@ import os.path from io import open from setuptools import find_packages, setup -try: - from azure_bdist_wheel import cmdclass -except ImportError: - from distutils import log as logger - logger.warn("Wheel is not available, disabling bdist_wheel hook") - cmdclass = {} # Change the PACKAGE_NAME only to change folder and different name PACKAGE_NAME = "azure-mgmt-search" -PACKAGE_PPRINT_NAME = "Search Management" +PACKAGE_PPRINT_NAME = "MyService Management" # a-b-c => a/b/c package_folder_path = PACKAGE_NAME.replace('-', '/') @@ -72,13 +66,22 @@ 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', 'License :: OSI Approved :: MIT License', ], zip_safe=False, - packages=find_packages(exclude=["tests"]), + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.mgmt', + ]), install_requires=[ - 'msrestazure>=0.4.27,<2.0.0', + 'msrest>=0.5.0', + 'msrestazure>=0.4.32,<2.0.0', 'azure-common~=1.1', ], - cmdclass=cmdclass + extras_require={ + ":python_version<'3.0'": ['azure-mgmt-nspkg'], + } ) From b4d7c9272cc9cb639b6c4faba2e962ca0c3ab33f Mon Sep 17 00:00:00 2001 From: azuresdkci Date: Tue, 19 Feb 2019 19:45:48 +0000 Subject: [PATCH 3/5] Packaging update of azure-mgmt-search --- azure-mgmt-search/README.rst | 25 +++---------------------- azure-mgmt-search/setup.py | 2 +- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/azure-mgmt-search/README.rst b/azure-mgmt-search/README.rst index 45de4e6b43dd..e31f6f56c60f 100644 --- a/azure-mgmt-search/README.rst +++ b/azure-mgmt-search/README.rst @@ -1,7 +1,7 @@ Microsoft Azure SDK for Python ============================== -This is the Microsoft Azure MyService Management Client Library. +This is the Microsoft Azure Search Management Client Library. Azure Resource Manager (ARM) is the next generation of management APIs that replace the old Azure Service Management (ASM). @@ -14,30 +14,11 @@ For the older Azure Service Management (ASM) libraries, see For a more complete set of Azure libraries, see the `azure `__ bundle package. -Compatibility -============= - -**IMPORTANT**: If you have an earlier version of the azure package -(version < 1.0), you should uninstall it before installing this package. - -You can check the version using pip: - -.. code:: shell - - pip freeze - -If you see azure==0.11.0 (or any version below 1.0), uninstall it first: - -.. code:: shell - - pip uninstall azure - - Usage ===== -For code examples, see `MyService Management -`__ +For code examples, see `Search Management +`__ on docs.microsoft.com. diff --git a/azure-mgmt-search/setup.py b/azure-mgmt-search/setup.py index d70a69b4a7e5..e429c58e6314 100644 --- a/azure-mgmt-search/setup.py +++ b/azure-mgmt-search/setup.py @@ -13,7 +13,7 @@ # Change the PACKAGE_NAME only to change folder and different name PACKAGE_NAME = "azure-mgmt-search" -PACKAGE_PPRINT_NAME = "MyService Management" +PACKAGE_PPRINT_NAME = "Search Management" # a-b-c => a/b/c package_folder_path = PACKAGE_NAME.replace('-', '/') From 414492445b54e1cdf1142dbaf0e48e56408e5696 Mon Sep 17 00:00:00 2001 From: Isabella Cai Date: Tue, 19 Feb 2019 11:56:53 -0800 Subject: [PATCH 4/5] updated versioning and changelog, pulled latest azure sdk tools --- azure-mgmt-search/HISTORY.rst | 10 +++++++++- azure-mgmt-search/azure/mgmt/search/version.py | 3 +-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/azure-mgmt-search/HISTORY.rst b/azure-mgmt-search/HISTORY.rst index c143af0d63ad..e7e96f02d0a3 100644 --- a/azure-mgmt-search/HISTORY.rst +++ b/azure-mgmt-search/HISTORY.rst @@ -3,6 +3,14 @@ Release History =============== +2.1.0 (2019-02-19) +++++++++++++++++++ + +**Features** + +- Model SearchService has a new parameter identity +- Model Resource has a new parameter identity + 2.0.0 (2018-05-21) ++++++++++++++++++ @@ -24,7 +32,7 @@ This version uses a next-generation code generator that *might* introduce breaki - Return type changes from `msrestazure.azure_operation.AzureOperationPoller` to `msrest.polling.LROPoller`. External API is the same. - Return type is now **always** a `msrest.polling.LROPoller`, regardless of the optional parameters used. - - The behavior has changed when using `raw=True`. Instead of returning the initial call result as `ClientRawResponse`, + - The behavior has changed when using `raw=True`. Instead of returning the initial call result as `ClientRawResponse`, without polling, now this returns an LROPoller. After polling, the final resource will be returned as a `ClientRawResponse`. - New `polling` parameter. The default behavior is `Polling=True` which will poll using ARM algorithm. When `Polling=False`, the response of the initial call will be returned without polling. diff --git a/azure-mgmt-search/azure/mgmt/search/version.py b/azure-mgmt-search/azure/mgmt/search/version.py index 373526c862b8..7ecf658ce13b 100644 --- a/azure-mgmt-search/azure/mgmt/search/version.py +++ b/azure-mgmt-search/azure/mgmt/search/version.py @@ -9,5 +9,4 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "2015-08-19" - +VERSION = "2.1.0" From 468c3acea29f9c6040ce9e6c0d997ea6da8ee49d Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 26 Feb 2019 11:57:06 -0800 Subject: [PATCH 5/5] [AutoPR search/resource-manager] [WaitForARMFeedback] Add api get_services_by_subscription of Azure Search (#4276) * Generated from 52d399a338e4f89936972f21db87a8dbbce1e08d add api get_services_by_subscription Add path of API "get search services by subscription" (GET/SUBSCRIPTIONS/PROVIDERS/MICROSOFT.SEARCH/SEARCHSERVICES) in the spec of API version 2015-08-19 of Azure Search (Microsoft.Search). Along with a sample. * Packaging update of azure-mgmt-search --- .../search/operations/services_operations.py | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/azure-mgmt-search/azure/mgmt/search/operations/services_operations.py b/azure-mgmt-search/azure/mgmt/search/operations/services_operations.py index d079d72e9d9f..c89b0d0e364d 100644 --- a/azure-mgmt-search/azure/mgmt/search/operations/services_operations.py +++ b/azure-mgmt-search/azure/mgmt/search/operations/services_operations.py @@ -467,6 +467,80 @@ def internal_paging(next_link=None, raw=False): 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