diff --git a/azure-mgmt-iothub/azure/mgmt/iothub/models/__init__.py b/azure-mgmt-iothub/azure/mgmt/iothub/models/__init__.py index c7db4806796e..a770971ce06b 100644 --- a/azure-mgmt-iothub/azure/mgmt/iothub/models/__init__.py +++ b/azure-mgmt-iothub/azure/mgmt/iothub/models/__init__.py @@ -54,6 +54,8 @@ from .user_subscription_quota_py3 import UserSubscriptionQuota from .user_subscription_quota_list_result_py3 import UserSubscriptionQuotaListResult from .routing_message_py3 import RoutingMessage + from .routing_twin_properties_py3 import RoutingTwinProperties + from .routing_twin_py3 import RoutingTwin from .test_all_routes_input_py3 import TestAllRoutesInput from .matched_route_py3 import MatchedRoute from .test_all_routes_result_py3 import TestAllRoutesResult @@ -110,6 +112,8 @@ from .user_subscription_quota import UserSubscriptionQuota from .user_subscription_quota_list_result import UserSubscriptionQuotaListResult from .routing_message import RoutingMessage + from .routing_twin_properties import RoutingTwinProperties + from .routing_twin import RoutingTwin from .test_all_routes_input import TestAllRoutesInput from .matched_route import MatchedRoute from .test_all_routes_result import TestAllRoutesResult @@ -191,6 +195,8 @@ 'UserSubscriptionQuota', 'UserSubscriptionQuotaListResult', 'RoutingMessage', + 'RoutingTwinProperties', + 'RoutingTwin', 'TestAllRoutesInput', 'MatchedRoute', 'TestAllRoutesResult', diff --git a/azure-mgmt-iothub/azure/mgmt/iothub/models/routing_twin.py b/azure-mgmt-iothub/azure/mgmt/iothub/models/routing_twin.py new file mode 100644 index 000000000000..e2405ca5f721 --- /dev/null +++ b/azure-mgmt-iothub/azure/mgmt/iothub/models/routing_twin.py @@ -0,0 +1,32 @@ +# 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 RoutingTwin(Model): + """Twin reference input parameter. This is an optional parameter. + + :param tags: Twin Tags + :type tags: object + :param properties: + :type properties: ~azure.mgmt.iothub.models.RoutingTwinProperties + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': 'object'}, + 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, + } + + def __init__(self, **kwargs): + super(RoutingTwin, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.properties = kwargs.get('properties', None) diff --git a/azure-mgmt-iothub/azure/mgmt/iothub/models/routing_twin_properties.py b/azure-mgmt-iothub/azure/mgmt/iothub/models/routing_twin_properties.py new file mode 100644 index 000000000000..5a2a524b2856 --- /dev/null +++ b/azure-mgmt-iothub/azure/mgmt/iothub/models/routing_twin_properties.py @@ -0,0 +1,32 @@ +# 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 RoutingTwinProperties(Model): + """RoutingTwinProperties. + + :param desired_properties: Twin desired properties + :type desired_properties: object + :param reported_properties: Twin desired properties + :type reported_properties: object + """ + + _attribute_map = { + 'desired_properties': {'key': 'desiredProperties', 'type': 'object'}, + 'reported_properties': {'key': 'reportedProperties', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(RoutingTwinProperties, self).__init__(**kwargs) + self.desired_properties = kwargs.get('desired_properties', None) + self.reported_properties = kwargs.get('reported_properties', None) diff --git a/azure-mgmt-iothub/azure/mgmt/iothub/models/routing_twin_properties_py3.py b/azure-mgmt-iothub/azure/mgmt/iothub/models/routing_twin_properties_py3.py new file mode 100644 index 000000000000..4d6b8bfcf34c --- /dev/null +++ b/azure-mgmt-iothub/azure/mgmt/iothub/models/routing_twin_properties_py3.py @@ -0,0 +1,32 @@ +# 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 RoutingTwinProperties(Model): + """RoutingTwinProperties. + + :param desired_properties: Twin desired properties + :type desired_properties: object + :param reported_properties: Twin desired properties + :type reported_properties: object + """ + + _attribute_map = { + 'desired_properties': {'key': 'desiredProperties', 'type': 'object'}, + 'reported_properties': {'key': 'reportedProperties', 'type': 'object'}, + } + + def __init__(self, *, desired_properties=None, reported_properties=None, **kwargs) -> None: + super(RoutingTwinProperties, self).__init__(**kwargs) + self.desired_properties = desired_properties + self.reported_properties = reported_properties diff --git a/azure-mgmt-iothub/azure/mgmt/iothub/models/routing_twin_py3.py b/azure-mgmt-iothub/azure/mgmt/iothub/models/routing_twin_py3.py new file mode 100644 index 000000000000..0badfbc7e89e --- /dev/null +++ b/azure-mgmt-iothub/azure/mgmt/iothub/models/routing_twin_py3.py @@ -0,0 +1,32 @@ +# 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 RoutingTwin(Model): + """Twin reference input parameter. This is an optional parameter. + + :param tags: Twin Tags + :type tags: object + :param properties: + :type properties: ~azure.mgmt.iothub.models.RoutingTwinProperties + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': 'object'}, + 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, + } + + def __init__(self, *, tags=None, properties=None, **kwargs) -> None: + super(RoutingTwin, self).__init__(**kwargs) + self.tags = tags + self.properties = properties diff --git a/azure-mgmt-iothub/azure/mgmt/iothub/models/test_all_routes_input.py b/azure-mgmt-iothub/azure/mgmt/iothub/models/test_all_routes_input.py index a05ffeb7498f..ac6820f6df5d 100644 --- a/azure-mgmt-iothub/azure/mgmt/iothub/models/test_all_routes_input.py +++ b/azure-mgmt-iothub/azure/mgmt/iothub/models/test_all_routes_input.py @@ -21,14 +21,18 @@ class TestAllRoutesInput(Model): :type routing_source: str or ~azure.mgmt.iothub.models.RoutingSource :param message: Routing message :type message: ~azure.mgmt.iothub.models.RoutingMessage + :param twin: Routing Twin Reference + :type twin: ~azure.mgmt.iothub.models.RoutingTwin """ _attribute_map = { 'routing_source': {'key': 'routingSource', 'type': 'str'}, 'message': {'key': 'message', 'type': 'RoutingMessage'}, + 'twin': {'key': 'twin', 'type': 'RoutingTwin'}, } def __init__(self, **kwargs): super(TestAllRoutesInput, self).__init__(**kwargs) self.routing_source = kwargs.get('routing_source', None) self.message = kwargs.get('message', None) + self.twin = kwargs.get('twin', None) diff --git a/azure-mgmt-iothub/azure/mgmt/iothub/models/test_all_routes_input_py3.py b/azure-mgmt-iothub/azure/mgmt/iothub/models/test_all_routes_input_py3.py index b9b31d6efe97..17e18f80df1f 100644 --- a/azure-mgmt-iothub/azure/mgmt/iothub/models/test_all_routes_input_py3.py +++ b/azure-mgmt-iothub/azure/mgmt/iothub/models/test_all_routes_input_py3.py @@ -21,14 +21,18 @@ class TestAllRoutesInput(Model): :type routing_source: str or ~azure.mgmt.iothub.models.RoutingSource :param message: Routing message :type message: ~azure.mgmt.iothub.models.RoutingMessage + :param twin: Routing Twin Reference + :type twin: ~azure.mgmt.iothub.models.RoutingTwin """ _attribute_map = { 'routing_source': {'key': 'routingSource', 'type': 'str'}, 'message': {'key': 'message', 'type': 'RoutingMessage'}, + 'twin': {'key': 'twin', 'type': 'RoutingTwin'}, } - def __init__(self, *, routing_source=None, message=None, **kwargs) -> None: + def __init__(self, *, routing_source=None, message=None, twin=None, **kwargs) -> None: super(TestAllRoutesInput, self).__init__(**kwargs) self.routing_source = routing_source self.message = message + self.twin = twin diff --git a/azure-mgmt-iothub/azure/mgmt/iothub/models/test_route_input.py b/azure-mgmt-iothub/azure/mgmt/iothub/models/test_route_input.py index f89938514813..68fce8a3fcc2 100644 --- a/azure-mgmt-iothub/azure/mgmt/iothub/models/test_route_input.py +++ b/azure-mgmt-iothub/azure/mgmt/iothub/models/test_route_input.py @@ -21,6 +21,8 @@ class TestRouteInput(Model): :type message: ~azure.mgmt.iothub.models.RoutingMessage :param route: Required. Route properties :type route: ~azure.mgmt.iothub.models.RouteProperties + :param twin: Routing Twin Reference + :type twin: ~azure.mgmt.iothub.models.RoutingTwin """ _validation = { @@ -30,9 +32,11 @@ class TestRouteInput(Model): _attribute_map = { 'message': {'key': 'message', 'type': 'RoutingMessage'}, 'route': {'key': 'route', 'type': 'RouteProperties'}, + 'twin': {'key': 'twin', 'type': 'RoutingTwin'}, } def __init__(self, **kwargs): super(TestRouteInput, self).__init__(**kwargs) self.message = kwargs.get('message', None) self.route = kwargs.get('route', None) + self.twin = kwargs.get('twin', None) diff --git a/azure-mgmt-iothub/azure/mgmt/iothub/models/test_route_input_py3.py b/azure-mgmt-iothub/azure/mgmt/iothub/models/test_route_input_py3.py index 054145312070..65df810dfd73 100644 --- a/azure-mgmt-iothub/azure/mgmt/iothub/models/test_route_input_py3.py +++ b/azure-mgmt-iothub/azure/mgmt/iothub/models/test_route_input_py3.py @@ -21,6 +21,8 @@ class TestRouteInput(Model): :type message: ~azure.mgmt.iothub.models.RoutingMessage :param route: Required. Route properties :type route: ~azure.mgmt.iothub.models.RouteProperties + :param twin: Routing Twin Reference + :type twin: ~azure.mgmt.iothub.models.RoutingTwin """ _validation = { @@ -30,9 +32,11 @@ class TestRouteInput(Model): _attribute_map = { 'message': {'key': 'message', 'type': 'RoutingMessage'}, 'route': {'key': 'route', 'type': 'RouteProperties'}, + 'twin': {'key': 'twin', 'type': 'RoutingTwin'}, } - def __init__(self, *, route, message=None, **kwargs) -> None: + def __init__(self, *, route, message=None, twin=None, **kwargs) -> None: super(TestRouteInput, self).__init__(**kwargs) self.message = message self.route = route + self.twin = twin diff --git a/azure-mgmt-iothub/azure/mgmt/iothub/operations/iot_hub_resource_operations.py b/azure-mgmt-iothub/azure/mgmt/iothub/operations/iot_hub_resource_operations.py index 9a5359e55915..c2356f337f88 100644 --- a/azure-mgmt-iothub/azure/mgmt/iothub/operations/iot_hub_resource_operations.py +++ b/azure-mgmt-iothub/azure/mgmt/iothub/operations/iot_hub_resource_operations.py @@ -1327,21 +1327,17 @@ def check_name_availability( check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability'} def test_all_routes( - self, iot_hub_name, resource_group_name, routing_source=None, message=None, custom_headers=None, raw=False, **operation_config): + self, input, iot_hub_name, resource_group_name, custom_headers=None, raw=False, **operation_config): """Test all routes. Test all routes configured in this Iot Hub. + :param input: Input for testing all routes + :type input: ~azure.mgmt.iothub.models.TestAllRoutesInput :param iot_hub_name: IotHub to be tested :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to :type resource_group_name: str - :param routing_source: Routing source. Possible values include: - 'Invalid', 'DeviceMessages', 'TwinChangeEvents', - 'DeviceLifecycleEvents', 'DeviceJobLifecycleEvents' - :type routing_source: str or ~azure.mgmt.iothub.models.RoutingSource - :param message: Routing message - :type message: ~azure.mgmt.iothub.models.RoutingMessage :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -1353,8 +1349,6 @@ def test_all_routes( :raises: :class:`ErrorDetailsException` """ - input = models.TestAllRoutesInput(routing_source=routing_source, message=message) - # Construct URL url = self.test_all_routes.metadata['url'] path_format_arguments = { @@ -1402,19 +1396,17 @@ def test_all_routes( test_all_routes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall'} def test_route( - self, iot_hub_name, resource_group_name, route, message=None, custom_headers=None, raw=False, **operation_config): + self, input, iot_hub_name, resource_group_name, custom_headers=None, raw=False, **operation_config): """Test the new route. Test the new route for this Iot Hub. + :param input: Route that needs to be tested + :type input: ~azure.mgmt.iothub.models.TestRouteInput :param iot_hub_name: IotHub to be tested :type iot_hub_name: str :param resource_group_name: resource group which Iot Hub belongs to :type resource_group_name: str - :param route: Route properties - :type route: ~azure.mgmt.iothub.models.RouteProperties - :param message: Routing message - :type message: ~azure.mgmt.iothub.models.RoutingMessage :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -1426,8 +1418,6 @@ def test_route( :raises: :class:`ErrorDetailsException` """ - input = models.TestRouteInput(message=message, route=route) - # Construct URL url = self.test_route.metadata['url'] path_format_arguments = {