From 602961edd63bd5027e969d24499620d0094fbdb5 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 14 Aug 2018 09:29:04 -0700 Subject: [PATCH 1/5] Generated from e12609aa0c7e69c6c34418f791480e311efe1317 (#3132) move stable iotcentral Go SDK package out of preview directory The 2018-09-01 package was incorrectly placed under the preview directory. Moved Go SDK config section to its own config file. --- .../iotcentral/operations/apps_operations.py | 43 +++++++++---------- .../mgmt/iotcentral/operations/operations.py | 7 ++- .../azure/mgmt/iotcentral/version.py | 3 +- 3 files changed, 25 insertions(+), 28 deletions(-) diff --git a/azure-mgmt-iotcentral/azure/mgmt/iotcentral/operations/apps_operations.py b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/operations/apps_operations.py index 4f5632207bbe..55a0ccce7828 100644 --- a/azure-mgmt-iotcentral/azure/mgmt/iotcentral/operations/apps_operations.py +++ b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/operations/apps_operations.py @@ -74,7 +74,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: @@ -83,8 +83,8 @@ def get( 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]: raise models.ErrorDetailsException(self._deserialize, response) @@ -119,6 +119,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()) @@ -131,9 +132,8 @@ def _create_or_update_initial( body_content = self._serialize.body(app, 'App') # 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, 202]: raise models.ErrorDetailsException(self._deserialize, response) @@ -226,6 +226,7 @@ def _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()) @@ -238,9 +239,8 @@ def _update_initial( body_content = self._serialize.body(app_patch, 'AppPatch') # 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, 202]: raise models.ErrorDetailsException(self._deserialize, response) @@ -328,7 +328,6 @@ def _delete_initial( # 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: @@ -337,8 +336,8 @@ def _delete_initial( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, '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, 202, 204]: raise models.ErrorDetailsException(self._deserialize, response) @@ -426,7 +425,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: @@ -435,9 +434,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]: raise models.ErrorDetailsException(self._deserialize, response) @@ -494,7 +492,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: @@ -503,9 +501,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]: raise models.ErrorDetailsException(self._deserialize, response) @@ -556,6 +553,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()) @@ -568,9 +566,8 @@ def check_name_availability( body_content = self._serialize.body(operation_inputs, 'OperationInputs') # 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]: raise models.ErrorDetailsException(self._deserialize, response) diff --git a/azure-mgmt-iotcentral/azure/mgmt/iotcentral/operations/operations.py b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/operations/operations.py index 379a116eee82..27e672e4d79b 100644 --- a/azure-mgmt-iotcentral/azure/mgmt/iotcentral/operations/operations.py +++ b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/operations/operations.py @@ -67,7 +67,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: @@ -76,9 +76,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]: raise models.ErrorDetailsException(self._deserialize, response) diff --git a/azure-mgmt-iotcentral/azure/mgmt/iotcentral/version.py b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/version.py index c995f7836cef..c9a9b899085f 100644 --- a/azure-mgmt-iotcentral/azure/mgmt/iotcentral/version.py +++ b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/version.py @@ -9,4 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.2.0" +VERSION = "2018-09-01" + From b77b088bb42c40babc0e47786b77b033625a6892 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 19 Oct 2018 13:38:02 -0700 Subject: [PATCH 2/5] [AutoPR iotcentral/resource-manager] IoTCentral - Add ARM endpoint, update model responses/inputs to align with expected values (#3444) * Generated from ddbb8ffb2dd676863a74cd5d44748fbd93a93025 Update models to align with expected responses * Packaging update of azure-mgmt-iotcentral * Generated from 09b4a4594660bc1c21dc7122a3784f64867a041e Fix build errors * Generated from 1c89739e3a40c9bf7a6f40e86367d50e6b88f776 Add required field to definitions * Generated from 92118d9753329c57349608f197514100d250974a Revert model name change. * Generated from f0df5982f4b75520b1b163b84ea33c9a81d6e79b add x-ms-client-flatten to errorSchema * Generated from 08b88d3a11055327409eafebcdac134e797bd38b Test default required field for .net SDK * Packaging update of azure-mgmt-iotcentral * Generated from 3089cb519400047ddfeaffa5fac50c5f1c7a3c85 test enum default * Generated from f878943d61f7e1cd88a4c5ff31a56c73e3ec0a00 revert test changes --- azure-mgmt-iotcentral/MANIFEST.in | 4 +- azure-mgmt-iotcentral/azure/__init__.py | 2 +- azure-mgmt-iotcentral/azure/mgmt/__init__.py | 2 +- .../azure/mgmt/iotcentral/models/__init__.py | 11 +-- ...ility_info.py => app_availability_info.py} | 23 +++--- ...fo_py3.py => app_availability_info_py3.py} | 25 +++--- .../mgmt/iotcentral/models/error_details.py | 10 ++- .../iotcentral/models/error_details_py3.py | 12 ++- .../iotcentral/models/error_response_body.py | 49 ++++++++++++ .../models/error_response_body_py3.py | 49 ++++++++++++ .../models/iot_central_client_enums.py | 6 -- .../iotcentral/models/operation_inputs.py | 7 +- .../iotcentral/models/operation_inputs_py3.py | 9 ++- .../iotcentral/operations/apps_operations.py | 78 +++++++++++++++++-- azure-mgmt-iotcentral/azure_bdist_wheel.py | 54 ------------- azure-mgmt-iotcentral/setup.cfg | 1 - azure-mgmt-iotcentral/setup.py | 17 ++-- 17 files changed, 242 insertions(+), 117 deletions(-) rename azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/{app_name_availability_info.py => app_availability_info.py} (68%) rename azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/{app_name_availability_info_py3.py => app_availability_info_py3.py} (66%) create mode 100644 azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/error_response_body.py create mode 100644 azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/error_response_body_py3.py delete mode 100644 azure-mgmt-iotcentral/azure_bdist_wheel.py diff --git a/azure-mgmt-iotcentral/MANIFEST.in b/azure-mgmt-iotcentral/MANIFEST.in index 9ecaeb15de50..6ceb27f7a96e 100644 --- a/azure-mgmt-iotcentral/MANIFEST.in +++ b/azure-mgmt-iotcentral/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-iotcentral/azure/__init__.py b/azure-mgmt-iotcentral/azure/__init__.py index 849489fca33c..0260537a02bb 100644 --- a/azure-mgmt-iotcentral/azure/__init__.py +++ b/azure-mgmt-iotcentral/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-iotcentral/azure/mgmt/__init__.py b/azure-mgmt-iotcentral/azure/mgmt/__init__.py index 849489fca33c..0260537a02bb 100644 --- a/azure-mgmt-iotcentral/azure/mgmt/__init__.py +++ b/azure-mgmt-iotcentral/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-iotcentral/azure/mgmt/iotcentral/models/__init__.py b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/__init__.py index dc2d42d83462..2819b4e949e1 100644 --- a/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/__init__.py +++ b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/__init__.py @@ -14,26 +14,27 @@ from .app_py3 import App from .app_patch_py3 import AppPatch from .resource_py3 import Resource + from .error_response_body_py3 import ErrorResponseBody from .error_details_py3 import ErrorDetails, ErrorDetailsException from .operation_display_py3 import OperationDisplay from .operation_py3 import Operation from .operation_inputs_py3 import OperationInputs - from .app_name_availability_info_py3 import AppNameAvailabilityInfo + from .app_availability_info_py3 import AppAvailabilityInfo except (SyntaxError, ImportError): from .app_sku_info import AppSkuInfo from .app import App from .app_patch import AppPatch from .resource import Resource + from .error_response_body import ErrorResponseBody from .error_details import ErrorDetails, ErrorDetailsException from .operation_display import OperationDisplay from .operation import Operation from .operation_inputs import OperationInputs - from .app_name_availability_info import AppNameAvailabilityInfo + from .app_availability_info import AppAvailabilityInfo from .app_paged import AppPaged from .operation_paged import OperationPaged from .iot_central_client_enums import ( AppSku, - AppNameUnavailabilityReason, ) __all__ = [ @@ -41,13 +42,13 @@ 'App', 'AppPatch', 'Resource', + 'ErrorResponseBody', 'ErrorDetails', 'ErrorDetailsException', 'OperationDisplay', 'Operation', 'OperationInputs', - 'AppNameAvailabilityInfo', + 'AppAvailabilityInfo', 'AppPaged', 'OperationPaged', 'AppSku', - 'AppNameUnavailabilityReason', ] diff --git a/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/app_name_availability_info.py b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/app_availability_info.py similarity index 68% rename from azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/app_name_availability_info.py rename to azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/app_availability_info.py index 5121fecc7259..b690919a286d 100644 --- a/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/app_name_availability_info.py +++ b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/app_availability_info.py @@ -12,9 +12,9 @@ from msrest.serialization import Model -class AppNameAvailabilityInfo(Model): - """The properties indicating whether a given IoT Central application name is - available. +class AppAvailabilityInfo(Model): + """The properties indicating whether a given IoT Central application name or + subdomain is available. Variables are only populated by the server, and will be ignored when sending a request. @@ -22,27 +22,26 @@ class AppNameAvailabilityInfo(Model): :ivar name_available: The value which indicates whether the provided name is available. :vartype name_available: bool - :ivar reason: The reason for unavailability. Possible values include: - 'Invalid', 'AlreadyExists' - :vartype reason: str or - ~azure.mgmt.iotcentral.models.AppNameUnavailabilityReason - :param message: The detailed reason message. - :type message: str + :ivar reason: The reason for unavailability. + :vartype reason: str + :ivar message: The detailed reason message. + :vartype message: str """ _validation = { 'name_available': {'readonly': True}, 'reason': {'readonly': True}, + 'message': {'readonly': True}, } _attribute_map = { 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'AppNameUnavailabilityReason'}, + 'reason': {'key': 'reason', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, } def __init__(self, **kwargs): - super(AppNameAvailabilityInfo, self).__init__(**kwargs) + super(AppAvailabilityInfo, self).__init__(**kwargs) self.name_available = None self.reason = None - self.message = kwargs.get('message', None) + self.message = None diff --git a/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/app_name_availability_info_py3.py b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/app_availability_info_py3.py similarity index 66% rename from azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/app_name_availability_info_py3.py rename to azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/app_availability_info_py3.py index 7549acd0baee..64c94d994ad1 100644 --- a/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/app_name_availability_info_py3.py +++ b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/app_availability_info_py3.py @@ -12,9 +12,9 @@ from msrest.serialization import Model -class AppNameAvailabilityInfo(Model): - """The properties indicating whether a given IoT Central application name is - available. +class AppAvailabilityInfo(Model): + """The properties indicating whether a given IoT Central application name or + subdomain is available. Variables are only populated by the server, and will be ignored when sending a request. @@ -22,27 +22,26 @@ class AppNameAvailabilityInfo(Model): :ivar name_available: The value which indicates whether the provided name is available. :vartype name_available: bool - :ivar reason: The reason for unavailability. Possible values include: - 'Invalid', 'AlreadyExists' - :vartype reason: str or - ~azure.mgmt.iotcentral.models.AppNameUnavailabilityReason - :param message: The detailed reason message. - :type message: str + :ivar reason: The reason for unavailability. + :vartype reason: str + :ivar message: The detailed reason message. + :vartype message: str """ _validation = { 'name_available': {'readonly': True}, 'reason': {'readonly': True}, + 'message': {'readonly': True}, } _attribute_map = { 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'AppNameUnavailabilityReason'}, + 'reason': {'key': 'reason', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, message: str=None, **kwargs) -> None: - super(AppNameAvailabilityInfo, self).__init__(**kwargs) + def __init__(self, **kwargs) -> None: + super(AppAvailabilityInfo, self).__init__(**kwargs) self.name_available = None self.reason = None - self.message = message + self.message = None diff --git a/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/error_details.py b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/error_details.py index a4886654fbff..b7f72f1b01b8 100644 --- a/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/error_details.py +++ b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/error_details.py @@ -25,6 +25,8 @@ class ErrorDetails(Model): :vartype message: str :ivar target: The target of the particular error. :vartype target: str + :param details: A list of additional details about the error. + :type details: list[~azure.mgmt.iotcentral.models.ErrorResponseBody] """ _validation = { @@ -34,9 +36,10 @@ class ErrorDetails(Model): } _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, + 'code': {'key': 'error.code', 'type': 'str'}, + 'message': {'key': 'error.message', 'type': 'str'}, + 'target': {'key': 'error.target', 'type': 'str'}, + 'details': {'key': 'error.details', 'type': '[ErrorResponseBody]'}, } def __init__(self, **kwargs): @@ -44,6 +47,7 @@ def __init__(self, **kwargs): self.code = None self.message = None self.target = None + self.details = kwargs.get('details', None) class ErrorDetailsException(HttpOperationError): diff --git a/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/error_details_py3.py b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/error_details_py3.py index c219c199294e..fadfc552be75 100644 --- a/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/error_details_py3.py +++ b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/error_details_py3.py @@ -25,6 +25,8 @@ class ErrorDetails(Model): :vartype message: str :ivar target: The target of the particular error. :vartype target: str + :param details: A list of additional details about the error. + :type details: list[~azure.mgmt.iotcentral.models.ErrorResponseBody] """ _validation = { @@ -34,16 +36,18 @@ class ErrorDetails(Model): } _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, + 'code': {'key': 'error.code', 'type': 'str'}, + 'message': {'key': 'error.message', 'type': 'str'}, + 'target': {'key': 'error.target', 'type': 'str'}, + 'details': {'key': 'error.details', 'type': '[ErrorResponseBody]'}, } - def __init__(self, **kwargs) -> None: + def __init__(self, *, details=None, **kwargs) -> None: super(ErrorDetails, self).__init__(**kwargs) self.code = None self.message = None self.target = None + self.details = details class ErrorDetailsException(HttpOperationError): diff --git a/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/error_response_body.py b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/error_response_body.py new file mode 100644 index 000000000000..2eb41a34cfe7 --- /dev/null +++ b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/error_response_body.py @@ -0,0 +1,49 @@ +# 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 ErrorResponseBody(Model): + """Details of error response. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The target of the particular error. + :vartype target: str + :param details: A list of additional details about the error. + :type details: list[~azure.mgmt.iotcentral.models.ErrorResponseBody] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponseBody]'}, + } + + def __init__(self, **kwargs): + super(ErrorResponseBody, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = kwargs.get('details', None) diff --git a/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/error_response_body_py3.py b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/error_response_body_py3.py new file mode 100644 index 000000000000..1e7115c11cb7 --- /dev/null +++ b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/error_response_body_py3.py @@ -0,0 +1,49 @@ +# 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 ErrorResponseBody(Model): + """Details of error response. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The target of the particular error. + :vartype target: str + :param details: A list of additional details about the error. + :type details: list[~azure.mgmt.iotcentral.models.ErrorResponseBody] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponseBody]'}, + } + + def __init__(self, *, details=None, **kwargs) -> None: + super(ErrorResponseBody, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = details diff --git a/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/iot_central_client_enums.py b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/iot_central_client_enums.py index 91780df77e5f..8883b672464f 100644 --- a/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/iot_central_client_enums.py +++ b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/iot_central_client_enums.py @@ -16,9 +16,3 @@ class AppSku(str, Enum): f1 = "F1" s1 = "S1" - - -class AppNameUnavailabilityReason(str, Enum): - - invalid = "Invalid" - already_exists = "AlreadyExists" diff --git a/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/operation_inputs.py b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/operation_inputs.py index 71bb28eb8639..e04c6fb8a4ad 100644 --- a/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/operation_inputs.py +++ b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/operation_inputs.py @@ -20,16 +20,21 @@ class OperationInputs(Model): :param name: Required. The name of the IoT Central application instance to check. :type name: str + :param type: The type of the IoT Central resource to query. Default value: + "IoTApps" . + :type type: str """ _validation = { - 'name': {'required': True}, + 'name': {'required': True, 'pattern': r'^[a-z0-9-]{1,63}$'}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, } def __init__(self, **kwargs): super(OperationInputs, self).__init__(**kwargs) self.name = kwargs.get('name', None) + self.type = kwargs.get('type', "IoTApps") diff --git a/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/operation_inputs_py3.py b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/operation_inputs_py3.py index e99d4a561bc4..b5ac59194737 100644 --- a/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/operation_inputs_py3.py +++ b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/operation_inputs_py3.py @@ -20,16 +20,21 @@ class OperationInputs(Model): :param name: Required. The name of the IoT Central application instance to check. :type name: str + :param type: The type of the IoT Central resource to query. Default value: + "IoTApps" . + :type type: str """ _validation = { - 'name': {'required': True}, + 'name': {'required': True, 'pattern': r'^[a-z0-9-]{1,63}$'}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, name: str, **kwargs) -> None: + def __init__(self, *, name: str, type: str="IoTApps", **kwargs) -> None: super(OperationInputs, self).__init__(**kwargs) self.name = name + self.type = type diff --git a/azure-mgmt-iotcentral/azure/mgmt/iotcentral/operations/apps_operations.py b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/operations/apps_operations.py index 55a0ccce7828..72c8f74b58ad 100644 --- a/azure-mgmt-iotcentral/azure/mgmt/iotcentral/operations/apps_operations.py +++ b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/operations/apps_operations.py @@ -521,24 +521,26 @@ def internal_paging(next_link=None, raw=False): list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/IoTApps'} def check_name_availability( - self, name, custom_headers=None, raw=False, **operation_config): + self, name, type="IoTApps", custom_headers=None, raw=False, **operation_config): """Check if an IoT Central application name is available. :param name: The name of the IoT Central application instance to check. :type name: str + :param type: The type of the IoT Central resource to query. + :type type: str :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: AppNameAvailabilityInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.iotcentral.models.AppNameAvailabilityInfo or + :return: AppAvailabilityInfo or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.iotcentral.models.AppAvailabilityInfo or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorDetailsException` """ - operation_inputs = models.OperationInputs(name=name) + operation_inputs = models.OperationInputs(name=name, type=type) # Construct URL url = self.check_name_availability.metadata['url'] @@ -575,7 +577,7 @@ def check_name_availability( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('AppNameAvailabilityInfo', response) + deserialized = self._deserialize('AppAvailabilityInfo', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -583,3 +585,69 @@ def check_name_availability( return deserialized check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/checkNameAvailability'} + + def check_subdomain_availability( + self, name, type="IoTApps", custom_headers=None, raw=False, **operation_config): + """Check if an IoT Central application subdomain is available. + + :param name: The name of the IoT Central application instance to + check. + :type name: str + :param type: The type of the IoT Central resource to query. + :type type: str + :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: AppAvailabilityInfo or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.iotcentral.models.AppAvailabilityInfo or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDetailsException` + """ + operation_inputs = models.OperationInputs(name=name, type=type) + + # Construct URL + url = self.check_subdomain_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') + + # Construct body + body_content = self._serialize.body(operation_inputs, 'OperationInputs') + + # 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]: + raise models.ErrorDetailsException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('AppAvailabilityInfo', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + check_subdomain_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/checkSubdomainAvailability'} diff --git a/azure-mgmt-iotcentral/azure_bdist_wheel.py b/azure-mgmt-iotcentral/azure_bdist_wheel.py deleted file mode 100644 index 8a81d1b61775..000000000000 --- a/azure-mgmt-iotcentral/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-iotcentral/setup.cfg b/azure-mgmt-iotcentral/setup.cfg index 856f4164982c..3c6e79cf31da 100644 --- a/azure-mgmt-iotcentral/setup.cfg +++ b/azure-mgmt-iotcentral/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-iotcentral/setup.py b/azure-mgmt-iotcentral/setup.py index 2bab09e942b9..632e3aab0ccb 100644 --- a/azure-mgmt-iotcentral/setup.py +++ b/azure-mgmt-iotcentral/setup.py @@ -10,12 +10,6 @@ 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-iotcentral" @@ -76,11 +70,18 @@ '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=[ '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 5286c86102dbe14fb26ac0e3807e40b370f86fee Mon Sep 17 00:00:00 2001 From: azuresdkci Date: Fri, 26 Oct 2018 20:52:49 +0000 Subject: [PATCH 3/5] Packaging update of azure-mgmt-iotcentral --- azure-mgmt-iotcentral/MANIFEST.in | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-mgmt-iotcentral/MANIFEST.in b/azure-mgmt-iotcentral/MANIFEST.in index ac87972df424..6ceb27f7a96e 100644 --- a/azure-mgmt-iotcentral/MANIFEST.in +++ b/azure-mgmt-iotcentral/MANIFEST.in @@ -1,3 +1,4 @@ include *.rst include azure/__init__.py include azure/mgmt/__init__.py + From 5be5c70ea3e566842a992ae68aa8ccc7270fbf81 Mon Sep 17 00:00:00 2001 From: Laurent Mazuel Date: Fri, 26 Oct 2018 14:17:21 -0700 Subject: [PATCH 4/5] IOTCentral 0.3.0 --- azure-mgmt-iotcentral/HISTORY.rst | 17 +++++++++++++++++ .../azure/mgmt/iotcentral/version.py | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/azure-mgmt-iotcentral/HISTORY.rst b/azure-mgmt-iotcentral/HISTORY.rst index f734c122f26e..6f14e5ceb2d9 100644 --- a/azure-mgmt-iotcentral/HISTORY.rst +++ b/azure-mgmt-iotcentral/HISTORY.rst @@ -3,6 +3,23 @@ Release History =============== +0.3.0 (2018-10-26) +++++++++++++++++++ + +**Features** + +- Model OperationInputs has a new parameter type +- Model ErrorDetails has a new parameter details +- Added operation AppsOperations.check_subdomain_availability + +**Breaking changes** + +- Operation AppsOperations.check_name_availability has a new signature + +**Note** + +- azure-mgmt-nspkg is not installed anymore on Python 3 (PEP420-based namespace package) + 0.2.0 (2018-08-07) ++++++++++++++++++ diff --git a/azure-mgmt-iotcentral/azure/mgmt/iotcentral/version.py b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/version.py index c9a9b899085f..3e682bbd5fb1 100644 --- a/azure-mgmt-iotcentral/azure/mgmt/iotcentral/version.py +++ b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "2018-09-01" +VERSION = "0.3.0" From e8e1cb85ea0752c99c0e452400732ec919b5bcf4 Mon Sep 17 00:00:00 2001 From: Laurent Mazuel Date: Fri, 26 Oct 2018 15:06:15 -0700 Subject: [PATCH 5/5] IoT is 1.0.0 --- azure-mgmt-iotcentral/HISTORY.rst | 2 +- azure-mgmt-iotcentral/azure/mgmt/iotcentral/version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-mgmt-iotcentral/HISTORY.rst b/azure-mgmt-iotcentral/HISTORY.rst index 6f14e5ceb2d9..afdf15c48011 100644 --- a/azure-mgmt-iotcentral/HISTORY.rst +++ b/azure-mgmt-iotcentral/HISTORY.rst @@ -3,7 +3,7 @@ Release History =============== -0.3.0 (2018-10-26) +1.0.0 (2018-10-26) ++++++++++++++++++ **Features** diff --git a/azure-mgmt-iotcentral/azure/mgmt/iotcentral/version.py b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/version.py index 3e682bbd5fb1..a39916c162ce 100644 --- a/azure-mgmt-iotcentral/azure/mgmt/iotcentral/version.py +++ b/azure-mgmt-iotcentral/azure/mgmt/iotcentral/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.3.0" +VERSION = "1.0.0"