diff --git a/azure-mgmt-iotcentral/HISTORY.rst b/azure-mgmt-iotcentral/HISTORY.rst index f734c122f26e..afdf15c48011 100644 --- a/azure-mgmt-iotcentral/HISTORY.rst +++ b/azure-mgmt-iotcentral/HISTORY.rst @@ -3,6 +3,23 @@ Release History =============== +1.0.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/MANIFEST.in b/azure-mgmt-iotcentral/MANIFEST.in index bb37a2723dae..6ceb27f7a96e 100644 --- a/azure-mgmt-iotcentral/MANIFEST.in +++ b/azure-mgmt-iotcentral/MANIFEST.in @@ -1 +1,4 @@ include *.rst +include azure/__init__.py +include azure/mgmt/__init__.py + 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 4f5632207bbe..72c8f74b58ad 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) @@ -524,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'] @@ -556,6 +555,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 +568,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) @@ -578,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) @@ -586,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/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..a39916c162ce 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 = "1.0.0" +