diff --git a/.gitignore b/.gitignore index 75ae694f3..eac07cca4 100644 --- a/.gitignore +++ b/.gitignore @@ -172,78 +172,7 @@ Thumbs.db #old nuget restore folder .nuget/ AutoRest/Generators/Ruby/*Tests/Gemfile.lock - -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -env/ -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -*.egg-info/ -.installed.cfg -*.egg - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*,cover - -# Translations -*.mo -*.pot - -# Django stuff: -*.log - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -ClientRuntimes/Python/Python35-64-ENV/pip-selfcheck.json -ClientRuntimes/Python/Python35-64-ENV/pyvenv.cfg -ClientRuntimes/Python/Python35-64-ENV/Scripts/activate.bat -ClientRuntimes/Python/Python35-64-ENV/Scripts/Activate.ps1 -ClientRuntimes/Python/Python35-64-ENV/Scripts/deactivate.bat -*.pyc - -#tox directory -*.tox - -#python code coverage -*.coverage +AutoRest/Generators/Ruby/*/RspecTests/Generated/* #dnx installation dnx-clr-win-x86*/ diff --git a/AutoRest/AutoRest.Core.Tests/AutoRestSettingsTests.cs b/AutoRest/AutoRest.Core.Tests/AutoRestSettingsTests.cs index 19ed7fb52..ea35c6b71 100644 --- a/AutoRest/AutoRest.Core.Tests/AutoRestSettingsTests.cs +++ b/AutoRest/AutoRest.Core.Tests/AutoRestSettingsTests.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Linq; using Microsoft.Rest.Generator.Logging; using Xunit; +using Microsoft.Rest.Generator.Test.Resource; namespace Microsoft.Rest.Generator.Test { @@ -91,7 +92,8 @@ namespace Microsoft.Rest.Generator.Test var settings = Settings.Create(new[] {"-Modeler", "foo"}); try { - settings.Validate(null); + var codeGenerator = new SampleCodeGenerator(settings); + settings.Validate(codeGenerator); Assert.True(false); } catch (CodeGenerationException e) diff --git a/AutoRest/AutoRest.Core/CodeGenerator.cs b/AutoRest/AutoRest.Core/CodeGenerator.cs index b91c27158..54be5f20c 100644 --- a/AutoRest/AutoRest.Core/CodeGenerator.cs +++ b/AutoRest/AutoRest.Core/CodeGenerator.cs @@ -56,7 +56,7 @@ namespace Microsoft.Rest.Generator /// /// the setting name /// - public virtual bool DoesSupportSetting(string settingName) + public virtual bool IsSettingSupported(string settingName) { // Don't support any customized setting return false; diff --git a/AutoRest/AutoRest.Core/Settings.cs b/AutoRest/AutoRest.Core/Settings.cs index b8f490514..c887cf58a 100644 --- a/AutoRest/AutoRest.Core/Settings.cs +++ b/AutoRest/AutoRest.Core/Settings.cs @@ -304,6 +304,11 @@ Licensed under the MIT License. See License.txt in the project root for license public void Validate(CodeGenerator codeGenerator) { + if (codeGenerator == null) + { + throw new ArgumentNullException("codeGenerator"); + } + foreach (PropertyInfo property in (typeof (Settings)).GetProperties()) { // If property value is not set - throw exception. @@ -314,11 +319,12 @@ Licensed under the MIT License. See License.txt in the project root for license Resources.ParameterValueIsMissing, property.Name); } } - if (CustomSettings != null && codeGenerator != null) + + if (CustomSettings != null) { foreach (var unmatchedSetting in CustomSettings.Keys) { - if (!codeGenerator.DoesSupportSetting(unmatchedSetting)) + if (!codeGenerator.IsSettingSupported(unmatchedSetting)) { Logger.LogError(new ArgumentException(unmatchedSetting), Resources.ParameterIsNotValid, unmatchedSetting); diff --git a/AutoRest/Generators/Python/.gitignore b/AutoRest/Generators/Python/.gitignore new file mode 100644 index 000000000..6ab65f878 --- /dev/null +++ b/AutoRest/Generators/Python/.gitignore @@ -0,0 +1,72 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +ClientRuntimes/Python/Python35-64-ENV/pip-selfcheck.json +ClientRuntimes/Python/Python35-64-ENV/pyvenv.cfg +ClientRuntimes/Python/Python35-64-ENV/Scripts/activate.bat +ClientRuntimes/Python/Python35-64-ENV/Scripts/Activate.ps1 +ClientRuntimes/Python/Python35-64-ENV/Scripts/deactivate.bat +*.pyc + +#tox directory +*.tox + +#python code coverage +*.coverage + diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/auto_rest_duration_test_service/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/auto_rest_duration_test_service/__init__.py index c2b33c38b..815affb2c 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/auto_rest_duration_test_service/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/auto_rest_duration_test_service/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/auto_rest_duration_test_service/api_client.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/auto_rest_duration_test_service/api_client.py index 9d83bb62d..f50844213 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/auto_rest_duration_test_service/api_client.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/auto_rest_duration_test_service/api_client.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -12,7 +12,7 @@ from msrest.service_client import ServiceClient from msrest import Serializer, Deserializer from msrestazure import AzureConfiguration -from .operations.duration_operations import durationOperations +from .operations.duration_operations import DurationOperations from . import models @@ -46,5 +46,5 @@ class AutoRestDurationTestService(object): self._deserialize = Deserializer(client_models) self.config = config - self.duration = durationOperations( + self.duration = DurationOperations( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/auto_rest_duration_test_service/models/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/auto_rest_duration_test_service/models/__init__.py index 1448b1ade..279ee4c88 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/auto_rest_duration_test_service/models/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/auto_rest_duration_test_service/models/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/auto_rest_duration_test_service/models/error.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/auto_rest_duration_test_service/models/error.py index 1413fe073..d6b15c22e 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/auto_rest_duration_test_service/models/error.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/auto_rest_duration_test_service/models/error.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/auto_rest_duration_test_service/operations/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/auto_rest_duration_test_service/operations/__init__.py index eb587d17f..6aa6558f5 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/auto_rest_duration_test_service/operations/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/auto_rest_duration_test_service/operations/__init__.py @@ -4,13 +4,13 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from .duration_operations import durationOperations +from .duration_operations import DurationOperations __all__ = [ - 'durationOperations', + 'DurationOperations', ] diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/auto_rest_duration_test_service/operations/duration_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/auto_rest_duration_test_service/operations/duration_operations.py index beba26c0b..2d60a815e 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/auto_rest_duration_test_service/operations/duration_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/auto_rest_duration_test_service/operations/duration_operations.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -16,7 +16,7 @@ import uuid from .. import models -class durationOperations(object): +class DurationOperations(object): def __init__(self, client, config, serializer, derserializer): @@ -30,22 +30,18 @@ class durationOperations(object): def get_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get null duration value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: timedelta or (timedelta, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/duration/null' @@ -83,23 +79,19 @@ class durationOperations(object): def put_positive_duration( self, duration_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put a positive duration value :param duration_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type duration_body: timedelta + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type duration_body: timedelta - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/duration/positiveduration' @@ -134,22 +126,18 @@ class durationOperations(object): def get_positive_duration( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get a positive duration value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: timedelta or (timedelta, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/duration/positiveduration' @@ -187,22 +175,18 @@ class durationOperations(object): def get_invalid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get an invalid duration value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: timedelta or (timedelta, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/duration/invalid' diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/setup.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/setup.py index 0065f162b..6e3e0a796 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/setup.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/setup.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -22,7 +22,7 @@ VERSION = "1.0.0" # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.10", "six >= 1.9", "certifi", "python-dateutil"] +REQUIRES = ["msrest>=0.0.1", "msrestazure>=0.0.1"] setup( name=NAME, diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/__init__.py index 135e45d87..b578fe7cf 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/api_client.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/api_client.py index 47666662b..734328941 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/api_client.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/api_client.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -12,7 +12,7 @@ from msrest.service_client import ServiceClient from msrest import Serializer, Deserializer from msrestazure import AzureConfiguration -from .operations.parameter_grouping_operations import parameter_groupingOperations +from .operations.parameter_grouping_operations import ParameterGroupingOperations from . import models @@ -46,5 +46,5 @@ class AutoRestParameterGroupingTestService(object): self._deserialize = Deserializer(client_models) self.config = config - self.parameter_grouping = parameter_groupingOperations( + self.parameter_grouping = ParameterGroupingOperations( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/models/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/models/__init__.py index 39c75b0f1..0b9400fe5 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/models/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/models/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/models/error.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/models/error.py index 1413fe073..d6b15c22e 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/models/error.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/models/error.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/models/first_parameter_group.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/models/first_parameter_group.py index 2b7150b95..6c9d9035c 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/models/first_parameter_group.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/models/first_parameter_group.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/models/parameter_grouping_post_multiple_parameter_groups_second_parameter_group.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/models/parameter_grouping_post_multiple_parameter_groups_second_parameter_group.py index d1238cf41..ab470d4fc 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/models/parameter_grouping_post_multiple_parameter_groups_second_parameter_group.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/models/parameter_grouping_post_multiple_parameter_groups_second_parameter_group.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/models/parameter_grouping_post_optional_parameters.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/models/parameter_grouping_post_optional_parameters.py index ef6e1e308..a1be44377 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/models/parameter_grouping_post_optional_parameters.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/models/parameter_grouping_post_optional_parameters.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/models/parameter_grouping_post_required_parameters.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/models/parameter_grouping_post_required_parameters.py index de9c951f3..ceb9ea46b 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/models/parameter_grouping_post_required_parameters.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/models/parameter_grouping_post_required_parameters.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/operations/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/operations/__init__.py index f85849c10..b15270843 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/operations/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/operations/__init__.py @@ -4,13 +4,13 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from .parameter_grouping_operations import parameter_groupingOperations +from .parameter_grouping_operations import ParameterGroupingOperations __all__ = [ - 'parameter_groupingOperations', + 'ParameterGroupingOperations', ] diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/operations/parameter_grouping_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/operations/parameter_grouping_operations.py index c6017503a..8f54b9717 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/operations/parameter_grouping_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/operations/parameter_grouping_operations.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -16,7 +16,7 @@ import uuid from .. import models -class parameter_groupingOperations(object): +class ParameterGroupingOperations(object): def __init__(self, client, config, serializer, derserializer): @@ -30,24 +30,21 @@ class parameter_groupingOperations(object): def post_required( self, parameter_grouping_post_required_parameters, custom_headers={}, raw=False, callback=None, **operation_config): """ - Post a bunch of required parameters grouped :param parameter_grouping_post_required_parameters: Additional parameters for the operation - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type parameter_grouping_post_required_parameters: + parametergroupingpostrequiredparameters + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type parameter_grouping_post_required_parameters: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - body = None if parameter_grouping_post_required_parameters is not None: body = parameter_grouping_post_required_parameters.body @@ -103,24 +100,21 @@ class parameter_groupingOperations(object): def post_optional( self, parameter_grouping_post_optional_parameters=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Post a bunch of optional parameters grouped :param parameter_grouping_post_optional_parameters: Additional parameters for the operation - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type parameter_grouping_post_optional_parameters: + parametergroupingpostoptionalparameters or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type parameter_grouping_post_optional_parameters: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - custom_header = None if parameter_grouping_post_optional_parameters is not None: custom_header = parameter_grouping_post_optional_parameters.custom_header @@ -162,29 +156,26 @@ class parameter_groupingOperations(object): def post_multiple_parameter_groups( self, first_parameter_group=None, parameter_grouping_post_multiple_parameter_groups_second_parameter_group=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Post parameters from multiple different parameter groups :param first_parameter_group: Additional parameters for the operation + :type first_parameter_group: firstparametergroup or none :param parameter_grouping_post_multiple_parameter_groups_second_parameter_group: Additional parameters for the operation - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type + parameter_grouping_post_multiple_parameter_groups_second_parameter_group: + parametergroupingpostmultipleparametergroupssecondparametergroup or + none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type first_parameter_group: object or none - :type - parameter_grouping_post_multiple_parameter_groups_second_parameter_group: - object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - header_one = None if first_parameter_group is not None: header_one = first_parameter_group.header_one @@ -236,23 +227,19 @@ class parameter_groupingOperations(object): def post_shared_parameter_group_object( self, first_parameter_group=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Post parameters with a shared parameter group object :param first_parameter_group: Additional parameters for the operation - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type first_parameter_group: firstparametergroup or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type first_parameter_group: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - header_one = None if first_parameter_group is not None: header_one = first_parameter_group.header_one diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/setup.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/setup.py index add0a78c0..fbf7616eb 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/setup.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/setup.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -22,7 +22,7 @@ VERSION = "1.0.0" # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.10", "six >= 1.9", "certifi", "python-dateutil"] +REQUIRES = ["msrest>=0.0.1", "msrestazure>=0.0.1"] setup( name=NAME, diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/auto_rest_report_service_for_azure/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/auto_rest_report_service_for_azure/__init__.py index 6765e748e..6dfdfbc09 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/auto_rest_report_service_for_azure/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/auto_rest_report_service_for_azure/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/auto_rest_report_service_for_azure/api_client.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/auto_rest_report_service_for_azure/api_client.py index 18ad9fc32..042ebfec4 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/auto_rest_report_service_for_azure/api_client.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/auto_rest_report_service_for_azure/api_client.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -53,22 +53,17 @@ class AutoRestReportServiceForAzure(object): def get_report( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get test coverage report - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/report/azure' diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/auto_rest_report_service_for_azure/models/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/auto_rest_report_service_for_azure/models/__init__.py index 1448b1ade..279ee4c88 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/auto_rest_report_service_for_azure/models/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/auto_rest_report_service_for_azure/models/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/auto_rest_report_service_for_azure/models/error.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/auto_rest_report_service_for_azure/models/error.py index 1413fe073..d6b15c22e 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/auto_rest_report_service_for_azure/models/error.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/auto_rest_report_service_for_azure/models/error.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/setup.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/setup.py index 99a25d68b..3a9baca64 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/setup.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/setup.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -22,7 +22,7 @@ VERSION = "1.0.0" # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.10", "six >= 1.9", "certifi", "python-dateutil"] +REQUIRES = ["msrest>=0.0.1", "msrestazure>=0.0.1"] setup( name=NAME, diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/__init__.py index 00d710ef3..5357debbc 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/api_client.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/api_client.py index 49a6957ef..7077dd453 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/api_client.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/api_client.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -12,14 +12,14 @@ from msrest.service_client import ServiceClient from msrest import Serializer, Deserializer from msrestazure import AzureConfiguration -from .operations.xms_client_request_id_operations import xms_client_request_idOperations -from .operations.subscription_in_credentials_operations import subscription_in_credentialsOperations -from .operations.subscription_in_method_operations import subscription_in_methodOperations -from .operations.api_version_default_operations import api_version_defaultOperations -from .operations.api_version_local_operations import api_version_localOperations -from .operations.skip_url_encoding_operations import skip_url_encodingOperations -from .operations.odata_operations import odataOperations -from .operations.header_operations import headerOperations +from .operations.xms_client_request_id_operations import XMsClientRequestIdOperations +from .operations.subscription_in_credentials_operations import SubscriptionInCredentialsOperations +from .operations.subscription_in_method_operations import SubscriptionInMethodOperations +from .operations.api_version_default_operations import ApiVersionDefaultOperations +from .operations.api_version_local_operations import ApiVersionLocalOperations +from .operations.skip_url_encoding_operations import SkipUrlEncodingOperations +from .operations.odata_operations import OdataOperations +from .operations.header_operations import HeaderOperations from . import models @@ -57,19 +57,19 @@ class AutoRestAzureSpecialParametersTestClient(object): self._deserialize = Deserializer(client_models) self.config = config - self.xms_client_request_id = xms_client_request_idOperations( + self.xms_client_request_id = XMsClientRequestIdOperations( self._client, self.config, self._serialize, self._deserialize) - self.subscription_in_credentials = subscription_in_credentialsOperations( + self.subscription_in_credentials = SubscriptionInCredentialsOperations( self._client, self.config, self._serialize, self._deserialize) - self.subscription_in_method = subscription_in_methodOperations( + self.subscription_in_method = SubscriptionInMethodOperations( self._client, self.config, self._serialize, self._deserialize) - self.api_version_default = api_version_defaultOperations( + self.api_version_default = ApiVersionDefaultOperations( self._client, self.config, self._serialize, self._deserialize) - self.api_version_local = api_version_localOperations( + self.api_version_local = ApiVersionLocalOperations( self._client, self.config, self._serialize, self._deserialize) - self.skip_url_encoding = skip_url_encodingOperations( + self.skip_url_encoding = SkipUrlEncodingOperations( self._client, self.config, self._serialize, self._deserialize) - self.odata = odataOperations( + self.odata = OdataOperations( self._client, self.config, self._serialize, self._deserialize) - self.header = headerOperations( + self.header = HeaderOperations( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/models/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/models/__init__.py index 0f67af9cd..041ae46fe 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/models/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/models/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/models/error.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/models/error.py index 1413fe073..d6b15c22e 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/models/error.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/models/error.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/models/odata_filter.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/models/odata_filter.py index ed076ccc1..876d685f5 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/models/odata_filter.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/models/odata_filter.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/__init__.py index b6134683a..52c4b89d8 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/__init__.py @@ -4,27 +4,27 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from .xms_client_request_id_operations import xms_client_request_idOperations -from .subscription_in_credentials_operations import subscription_in_credentialsOperations -from .subscription_in_method_operations import subscription_in_methodOperations -from .api_version_default_operations import api_version_defaultOperations -from .api_version_local_operations import api_version_localOperations -from .skip_url_encoding_operations import skip_url_encodingOperations -from .odata_operations import odataOperations -from .header_operations import headerOperations +from .xms_client_request_id_operations import XMsClientRequestIdOperations +from .subscription_in_credentials_operations import SubscriptionInCredentialsOperations +from .subscription_in_method_operations import SubscriptionInMethodOperations +from .api_version_default_operations import ApiVersionDefaultOperations +from .api_version_local_operations import ApiVersionLocalOperations +from .skip_url_encoding_operations import SkipUrlEncodingOperations +from .odata_operations import OdataOperations +from .header_operations import HeaderOperations __all__ = [ - 'xms_client_request_idOperations', - 'subscription_in_credentialsOperations', - 'subscription_in_methodOperations', - 'api_version_defaultOperations', - 'api_version_localOperations', - 'skip_url_encodingOperations', - 'odataOperations', - 'headerOperations', + 'XMsClientRequestIdOperations', + 'SubscriptionInCredentialsOperations', + 'SubscriptionInMethodOperations', + 'ApiVersionDefaultOperations', + 'ApiVersionLocalOperations', + 'SkipUrlEncodingOperations', + 'OdataOperations', + 'HeaderOperations', ] diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/api_version_default_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/api_version_default_operations.py index aa77ab459..b527e3b48 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/api_version_default_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/api_version_default_operations.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -16,7 +16,7 @@ import uuid from .. import models -class api_version_defaultOperations(object): +class ApiVersionDefaultOperations(object): def __init__(self, client, config, serializer, derserializer): @@ -30,21 +30,17 @@ class api_version_defaultOperations(object): def get_method_global_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - GET method with api-version modeled in global settings. - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azurespecials/apiVersion/method/string/none/query/global/2015-07-01-preview' @@ -76,21 +72,17 @@ class api_version_defaultOperations(object): def get_method_global_not_provided_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - GET method with api-version modeled in global settings. - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azurespecials/apiVersion/method/string/none/query/globalNotProvided/2015-07-01-preview' @@ -122,21 +114,17 @@ class api_version_defaultOperations(object): def get_path_global_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - GET method with api-version modeled in global settings. - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azurespecials/apiVersion/path/string/none/query/global/2015-07-01-preview' @@ -168,21 +156,17 @@ class api_version_defaultOperations(object): def get_swagger_global_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - GET method with api-version modeled in global settings. - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azurespecials/apiVersion/swagger/string/none/query/global/2015-07-01-preview' diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/api_version_local_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/api_version_local_operations.py index e7c9a3577..a874c54b6 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/api_version_local_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/api_version_local_operations.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -16,7 +16,7 @@ import uuid from .. import models -class api_version_localOperations(object): +class ApiVersionLocalOperations(object): def __init__(self, client, config, serializer, derserializer): @@ -30,25 +30,21 @@ class api_version_localOperations(object): def get_method_local_valid( self, api_version, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed :param api_version: This should appear as a method parameter, use value '2.0'. Possible values for this parameter include: '2.0' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type api_version: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type api_version: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azurespecials/apiVersion/method/string/none/query/local/2.0' @@ -80,25 +76,21 @@ class api_version_localOperations(object): def get_method_local_null( self, api_version=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get method with api-version modeled in the method. pass in api-version = null to succeed :param api_version: This should appear as a method parameter, use value null, this should result in no serialized parameter - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type api_version: str or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type api_version: str or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azurespecials/apiVersion/method/string/none/query/local/null' @@ -131,25 +123,21 @@ class api_version_localOperations(object): def get_path_local_valid( self, api_version, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed :param api_version: This should appear as a method parameter, use value '2.0'. Possible values for this parameter include: '2.0' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type api_version: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type api_version: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azurespecials/apiVersion/path/string/none/query/local/2.0' @@ -181,26 +169,22 @@ class api_version_localOperations(object): def get_swagger_local_valid( self, api_version, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed :param api_version: The api version, which appears in the query, the value is always '2.0'. Possible values for this parameter include: '2.0' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type api_version: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type api_version: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azurespecials/apiVersion/swagger/string/none/query/local/2.0' diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/header_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/header_operations.py index 514d9bcc9..2254313ea 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/header_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/header_operations.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -16,7 +16,7 @@ import uuid from .. import models -class headerOperations(object): +class HeaderOperations(object): def __init__(self, client, config, serializer, derserializer): @@ -30,24 +30,20 @@ class headerOperations(object): def custom_named_request_id( self, foo_client_request_id, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request :param foo_client_request_id: The fooRequestId - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type foo_client_request_id: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type foo_client_request_id: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azurespecials/customNamedRequestId' diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/odata_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/odata_operations.py index 3d084c245..543291af1 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/odata_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/odata_operations.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -16,7 +16,7 @@ import uuid from .. import models -class odataOperations(object): +class OdataOperations(object): def __init__(self, client, config, serializer, derserializer): @@ -30,29 +30,25 @@ class odataOperations(object): def get_with_filter( self, filter=None, top=None, orderby=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Specify filter parameter with value '$filter=id gt 5 and name eq 'foo'&$orderby=id&$top=10' :param filter: The filter parameter with value '$filter=id gt 5 and name eq 'foo''. + :type filter: odatafilter or none :param top: The top parameter with value 10. + :type top: int or none :param orderby: The orderby parameter with value id. - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type orderby: str or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type filter: object or none - :type top: int or none - :type orderby: str or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azurespecials/odata/filter' diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/skip_url_encoding_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/skip_url_encoding_operations.py index 797d0942c..1bf8404e0 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/skip_url_encoding_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/skip_url_encoding_operations.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -16,7 +16,7 @@ import uuid from .. import models -class skip_url_encodingOperations(object): +class SkipUrlEncodingOperations(object): def __init__(self, client, config, serializer, derserializer): @@ -30,24 +30,20 @@ class skip_url_encodingOperations(object): def get_method_path_valid( self, unencoded_path_param, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get method with unencoded path parameter with value 'path1/path2/path3' :param unencoded_path_param: Unencoded path parameter with value 'path1/path2/path3' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type unencoded_path_param: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type unencoded_path_param: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azurespecials/skipUrlEncoding/method/path/valid/{unencodedPathParam}' path_format_arguments = { @@ -82,24 +78,20 @@ class skip_url_encodingOperations(object): def get_path_path_valid( self, unencoded_path_param, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get method with unencoded path parameter with value 'path1/path2/path3' :param unencoded_path_param: Unencoded path parameter with value 'path1/path2/path3' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type unencoded_path_param: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type unencoded_path_param: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azurespecials/skipUrlEncoding/path/path/valid/{unencodedPathParam}' path_format_arguments = { @@ -134,25 +126,21 @@ class skip_url_encodingOperations(object): def get_swagger_path_valid( self, unencoded_path_param, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get method with unencoded path parameter with value 'path1/path2/path3' :param unencoded_path_param: An unencoded path parameter with value 'path1/path2/path3'. Possible values for this parameter include: 'path1/path2/path3' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type unencoded_path_param: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type unencoded_path_param: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azurespecials/skipUrlEncoding/swagger/path/valid/{unencodedPathParam}' path_format_arguments = { @@ -187,25 +175,21 @@ class skip_url_encodingOperations(object): def get_method_query_valid( self, q1, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get method with unencoded query parameter with value 'value1&q2=value2&q3=value3' :param q1: Unencoded query parameter with value 'value1&q2=value2&q3=value3' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type q1: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type q1: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azurespecials/skipUrlEncoding/method/query/valid' @@ -237,23 +221,19 @@ class skip_url_encodingOperations(object): def get_method_query_null( self, q1=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get method with unencoded query parameter with value null :param q1: Unencoded query parameter with value null - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type q1: str or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type q1: str or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azurespecials/skipUrlEncoding/method/query/null' @@ -286,25 +266,21 @@ class skip_url_encodingOperations(object): def get_path_query_valid( self, q1, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get method with unencoded query parameter with value 'value1&q2=value2&q3=value3' :param q1: Unencoded query parameter with value 'value1&q2=value2&q3=value3' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type q1: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type q1: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azurespecials/skipUrlEncoding/path/query/valid' @@ -336,26 +312,22 @@ class skip_url_encodingOperations(object): def get_swagger_query_valid( self, q1=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get method with unencoded query parameter with value 'value1&q2=value2&q3=value3' :param q1: An unencoded query parameter with value 'value1&q2=value2&q3=value3'. Possible values for this parameter include: 'value1&q2=value2&q3=value3' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type q1: str or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type q1: str or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azurespecials/skipUrlEncoding/swagger/query/valid' diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/subscription_in_credentials_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/subscription_in_credentials_operations.py index cb9f6397f..3b8aba1a0 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/subscription_in_credentials_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/subscription_in_credentials_operations.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -16,7 +16,7 @@ import uuid from .. import models -class subscription_in_credentialsOperations(object): +class SubscriptionInCredentialsOperations(object): def __init__(self, client, config, serializer, derserializer): @@ -30,22 +30,18 @@ class subscription_in_credentialsOperations(object): def post_method_global_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azurespecials/subscriptionId/method/string/none/path/global/1234-5678-9012-3456/{subscriptionId}' path_format_arguments = { @@ -80,23 +76,19 @@ class subscription_in_credentialsOperations(object): def post_method_global_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to null, and client-side validation should prevent you from making this call - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azurespecials/subscriptionId/method/string/none/path/global/null/{subscriptionId}' path_format_arguments = { @@ -131,22 +123,18 @@ class subscription_in_credentialsOperations(object): def post_method_global_not_provided_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azurespecials/subscriptionId/method/string/none/path/globalNotProvided/1234-5678-9012-3456/{subscriptionId}' path_format_arguments = { @@ -182,22 +170,18 @@ class subscription_in_credentialsOperations(object): def post_path_global_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azurespecials/subscriptionId/path/string/none/path/global/1234-5678-9012-3456/{subscriptionId}' path_format_arguments = { @@ -232,22 +216,18 @@ class subscription_in_credentialsOperations(object): def post_swagger_global_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azurespecials/subscriptionId/swagger/string/none/path/global/1234-5678-9012-3456/{subscriptionId}' path_format_arguments = { diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/subscription_in_method_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/subscription_in_method_operations.py index 338b864c8..f8b4f18d4 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/subscription_in_method_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/subscription_in_method_operations.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -16,7 +16,7 @@ import uuid from .. import models -class subscription_in_methodOperations(object): +class SubscriptionInMethodOperations(object): def __init__(self, client, config, serializer, derserializer): @@ -30,25 +30,21 @@ class subscription_in_methodOperations(object): def post_method_local_valid( self, subscription_id, custom_headers={}, raw=False, callback=None, **operation_config): """ - POST method with subscriptionId modeled in the method. pass in subscription id = '1234-5678-9012-3456' to succeed :param subscription_id: This should appear as a method parameter, use value '1234-5678-9012-3456' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type subscription_id: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type subscription_id: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azurespecials/subscriptionId/method/string/none/path/local/1234-5678-9012-3456/{subscriptionId}' path_format_arguments = { @@ -83,26 +79,22 @@ class subscription_in_methodOperations(object): def post_method_local_null( self, subscription_id, custom_headers={}, raw=False, callback=None, **operation_config): """ - POST method with subscriptionId modeled in the method. pass in subscription id = null, client-side validation should prevent you from making this call :param subscription_id: This should appear as a method parameter, use value null, client-side validation should prvenet the call - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type subscription_id: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type subscription_id: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azurespecials/subscriptionId/method/string/none/path/local/null/{subscriptionId}' path_format_arguments = { @@ -137,25 +129,21 @@ class subscription_in_methodOperations(object): def post_path_local_valid( self, subscription_id, custom_headers={}, raw=False, callback=None, **operation_config): """ - POST method with subscriptionId modeled in the method. pass in subscription id = '1234-5678-9012-3456' to succeed :param subscription_id: Should appear as a method parameter -use value '1234-5678-9012-3456' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type subscription_id: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type subscription_id: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azurespecials/subscriptionId/path/string/none/path/local/1234-5678-9012-3456/{subscriptionId}' path_format_arguments = { @@ -190,25 +178,21 @@ class subscription_in_methodOperations(object): def post_swagger_local_valid( self, subscription_id, custom_headers={}, raw=False, callback=None, **operation_config): """ - POST method with subscriptionId modeled in the method. pass in subscription id = '1234-5678-9012-3456' to succeed :param subscription_id: The subscriptionId, which appears in the path, the value is always '1234-5678-9012-3456' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type subscription_id: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type subscription_id: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azurespecials/subscriptionId/swagger/string/none/path/local/1234-5678-9012-3456/{subscriptionId}' path_format_arguments = { diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/xms_client_request_id_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/xms_client_request_id_operations.py index d5abff23d..a4fd8bfca 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/xms_client_request_id_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/auto_rest_azure_special_parameters_test_client/operations/xms_client_request_id_operations.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -16,7 +16,7 @@ import uuid from .. import models -class xms_client_request_idOperations(object): +class XMsClientRequestIdOperations(object): def __init__(self, client, config, serializer, derserializer): @@ -30,22 +30,18 @@ class xms_client_request_idOperations(object): def get( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get method that overwrites x-ms-client-request header with value 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azurespecials/overwrite/x-ms-client-request-id/method/' @@ -76,25 +72,21 @@ class xms_client_request_idOperations(object): def param_get( self, x_ms_client_request_id, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get method that overwrites x-ms-client-request header with value 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. :param x_ms_client_request_id: This should appear as a method parameter, use value '9C4D50EE-2D56-4CD3-8152-34347DC9F2B0' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type x_ms_client_request_id: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type x_ms_client_request_id: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azurespecials/overwrite/x-ms-client-request-id/via-param/method/' diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/setup.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/setup.py index 33c165d77..53b69fcb2 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/setup.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/setup.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -22,7 +22,7 @@ VERSION = "2015-07-01-preview" # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.10", "six >= 1.9", "certifi", "python-dateutil"] +REQUIRES = ["msrest>=0.0.1", "msrestazure>=0.0.1"] setup( name=NAME, diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/auto_rest_head_test_service/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/auto_rest_head_test_service/__init__.py index 31322767f..7c803af39 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/auto_rest_head_test_service/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/auto_rest_head_test_service/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/auto_rest_head_test_service/api_client.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/auto_rest_head_test_service/api_client.py index 55b1b6c80..cebb48854 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/auto_rest_head_test_service/api_client.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/auto_rest_head_test_service/api_client.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -12,7 +12,7 @@ from msrest.service_client import ServiceClient from msrest import Serializer, Deserializer from msrestazure import AzureConfiguration -from .operations.http_success_operations import http_successOperations +from .operations.http_success_operations import HttpSuccessOperations class AutoRestHeadTestServiceConfiguration(AzureConfiguration): @@ -45,5 +45,5 @@ class AutoRestHeadTestService(object): self._deserialize = Deserializer(client_models) self.config = config - self.http_success = http_successOperations( + self.http_success = HttpSuccessOperations( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/auto_rest_head_test_service/operations/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/auto_rest_head_test_service/operations/__init__.py index fb72a0a2a..f8238b2d2 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/auto_rest_head_test_service/operations/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/auto_rest_head_test_service/operations/__init__.py @@ -4,13 +4,13 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from .http_success_operations import http_successOperations +from .http_success_operations import HttpSuccessOperations __all__ = [ - 'http_successOperations', + 'HttpSuccessOperations', ] diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/auto_rest_head_test_service/operations/http_success_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/auto_rest_head_test_service/operations/http_success_operations.py index ced1ec311..cf5b56d41 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/auto_rest_head_test_service/operations/http_success_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/auto_rest_head_test_service/operations/http_success_operations.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrestazure.azure_exceptions import CloudError import uuid -class http_successOperations(object): +class HttpSuccessOperations(object): def __init__(self, client, config, serializer, derserializer): @@ -29,21 +29,17 @@ class http_successOperations(object): def head200( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 200 status code if successful - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: bool or (bool, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/success/200' @@ -76,21 +72,17 @@ class http_successOperations(object): def head204( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 204 status code if successful - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: bool or (bool, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/success/204' @@ -123,21 +115,17 @@ class http_successOperations(object): def head404( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 404 status code if successful - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: bool or (bool, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/success/404' diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/setup.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/setup.py index c3bb2b4ac..28feec875 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/setup.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/setup.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -22,7 +22,7 @@ VERSION = "1.0.0" # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.10", "six >= 1.9", "certifi", "python-dateutil"] +REQUIRES = ["msrest>=0.0.1", "msrestazure>=0.0.1"] setup( name=NAME, diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/__init__.py index 537bdc92e..c76569058 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/api_client.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/api_client.py index a9ed90cf6..a8b2e9df4 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/api_client.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/api_client.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -12,10 +12,10 @@ from msrest.service_client import ServiceClient from msrest import Serializer, Deserializer from msrestazure import AzureConfiguration -from .operations.lr_os_operations import lr_osOperations -from .operations.lro_retrys_operations import lro_retrysOperations -from .operations.lrosa_ds_operations import lrosa_dsOperations -from .operations.lr_os_custom_header_operations import lr_os_custom_headerOperations +from .operations.lr_os_operations import LROsOperations +from .operations.lro_retrys_operations import LRORetrysOperations +from .operations.lrosa_ds_operations import LROSADsOperations +from .operations.lr_os_custom_header_operations import LROsCustomHeaderOperations from . import models @@ -49,11 +49,11 @@ class AutoRestLongRunningOperationTestService(object): self._deserialize = Deserializer(client_models) self.config = config - self.lr_os = lr_osOperations( + self.lr_os = LROsOperations( self._client, self.config, self._serialize, self._deserialize) - self.lro_retrys = lro_retrysOperations( + self.lro_retrys = LRORetrysOperations( self._client, self.config, self._serialize, self._deserialize) - self.lrosa_ds = lrosa_dsOperations( + self.lrosa_ds = LROSADsOperations( self._client, self.config, self._serialize, self._deserialize) - self.lr_os_custom_header = lr_os_custom_headerOperations( + self.lr_os_custom_header = LROsCustomHeaderOperations( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/__init__.py index 8e1e7b917..f57b4a25e 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/operation_result.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/operation_result.py index 43749f132..d0abaad81 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/operation_result.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/operation_result.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/operation_result_error.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/operation_result_error.py index da5193123..75885f699 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/operation_result_error.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/operation_result_error.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/product.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/product.py index a600c7b0a..898a17dde 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/product.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/product.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/resource.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/resource.py index 8250984fd..f4acb67a6 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/resource.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/resource.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/sku.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/sku.py index a0001cf8f..184cdd01c 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/sku.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/sku.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/sub_product.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/sub_product.py index 608da0f01..4d9c7845c 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/sub_product.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/sub_product.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/sub_resource.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/sub_resource.py index 4b3bafae9..df4989992 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/sub_resource.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/models/sub_resource.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/operations/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/operations/__init__.py index 2152cb4af..140e76805 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/operations/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/operations/__init__.py @@ -4,19 +4,19 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from .lr_os_operations import lr_osOperations -from .lro_retrys_operations import lro_retrysOperations -from .lrosa_ds_operations import lrosa_dsOperations -from .lr_os_custom_header_operations import lr_os_custom_headerOperations +from .lr_os_operations import LROsOperations +from .lro_retrys_operations import LRORetrysOperations +from .lrosa_ds_operations import LROSADsOperations +from .lr_os_custom_header_operations import LROsCustomHeaderOperations __all__ = [ - 'lr_osOperations', - 'lro_retrysOperations', - 'lrosa_dsOperations', - 'lr_os_custom_headerOperations', + 'LROsOperations', + 'LRORetrysOperations', + 'LROSADsOperations', + 'LROsCustomHeaderOperations', ] diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/operations/lr_os_custom_header_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/operations/lr_os_custom_header_operations.py index 9cfd14fd4..38c5d8724 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/operations/lr_os_custom_header_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/operations/lr_os_custom_header_operations.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -18,7 +18,7 @@ import uuid from .. import models -class lr_os_custom_headerOperations(object): +class LROsCustomHeaderOperations(object): def __init__(self, client, config, serializer, derserializer): @@ -31,7 +31,6 @@ class lr_os_custom_headerOperations(object): def put_async_retry_succeeded( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 200 to the initial request, with an entity that @@ -39,20 +38,17 @@ class lr_os_custom_headerOperations(object): the Azure-AsyncOperation header for operation status :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/customheader/putasync/retry/succeeded' @@ -120,7 +116,6 @@ class lr_os_custom_headerOperations(object): def put201_creating_succeeded200( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 201 to the initial request, with an entity that @@ -128,20 +123,17 @@ class lr_os_custom_headerOperations(object): the last poll returns a ‘200’ with ProvisioningState=’Succeeded’ :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/customheader/put/201/creating/succeeded/200' @@ -205,7 +197,6 @@ class lr_os_custom_headerOperations(object): def post202_retry200( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with 'Location' and @@ -213,19 +204,16 @@ class lr_os_custom_headerOperations(object): success :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/customheader/post/202/retry/200' @@ -284,7 +272,6 @@ class lr_os_custom_headerOperations(object): def post_async_retry_succeeded( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with an entity that @@ -292,19 +279,16 @@ class lr_os_custom_headerOperations(object): the Azure-AsyncOperation header for operation status :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/customheader/postasync/retry/succeeded' diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/operations/lr_os_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/operations/lr_os_operations.py index 5c8673c9f..6b7c22759 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/operations/lr_os_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/operations/lr_os_operations.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -18,7 +18,7 @@ import uuid from .. import models -class lr_osOperations(object): +class LROsOperations(object): def __init__(self, client, config, serializer, derserializer): @@ -31,25 +31,21 @@ class lr_osOperations(object): def put200_succeeded( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/put/200/succeeded' @@ -111,26 +107,22 @@ class lr_osOperations(object): def put200_succeeded_no_state( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running put request, service returns a 200 to the initial request, with an entity that does not contain ProvisioningState=’Succeeded’. :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/put/200/succeeded/nostate' @@ -192,26 +184,22 @@ class lr_osOperations(object): def put202_retry200( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running put request, service returns a 202 to the initial request, with a location header that points to a polling URL that returns a 200 and an entity that doesn't contains ProvisioningState :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/put/202/retry/200' @@ -273,27 +261,23 @@ class lr_osOperations(object): def put201_creating_succeeded200( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’ :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/put/201/creating/succeeded/200' @@ -357,27 +341,23 @@ class lr_osOperations(object): def put200_updating_succeeded204( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Updating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’ :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/put/200/updating/succeeded/200' @@ -439,27 +419,23 @@ class lr_osOperations(object): def put201_creating_failed200( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Created’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’ :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/put/201/created/failed/200' @@ -523,27 +499,23 @@ class lr_osOperations(object): def put200_acceptedcanceled200( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’ :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/put/200/accepted/canceled/200' @@ -605,26 +577,22 @@ class lr_osOperations(object): def put_no_header_in_retry( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running put request, service returns a 202 to the initial request with location header. Subsequent calls to operation status do not contain location header. :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/put/noheader/202/200' @@ -690,27 +658,23 @@ class lr_osOperations(object): def put_async_retry_succeeded( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/putasync/retry/succeeded' @@ -778,27 +742,23 @@ class lr_osOperations(object): def put_async_no_retry_succeeded( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/putasync/noretry/succeeded' @@ -865,27 +825,23 @@ class lr_osOperations(object): def put_async_retry_failed( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/putasync/retry/failed' @@ -953,27 +909,23 @@ class lr_osOperations(object): def put_async_no_retrycanceled( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/putasync/noretry/canceled' @@ -1040,26 +992,22 @@ class lr_osOperations(object): def put_async_no_header_in_retry( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running put request, service returns a 202 to the initial request with Azure-AsyncOperation header. Subsequent calls to operation status do not contain Azure-AsyncOperation header. :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/putasync/noheader/201/200' @@ -1125,24 +1073,19 @@ class lr_osOperations(object): def put_non_resource( self, sku=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running put request with non resource. :param sku: sku to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type sku: sku or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type sku: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: sku or (sku, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/putnonresource/202/200' @@ -1204,24 +1147,19 @@ class lr_osOperations(object): def put_async_non_resource( self, sku=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running put request with non resource. :param sku: Sku to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type sku: sku or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type sku: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: sku or (sku, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/putnonresourceasync/202/200' @@ -1283,24 +1221,20 @@ class lr_osOperations(object): def put_sub_resource( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running put request with sub resource. :param product: Sub Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: subproduct or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: subproduct or (subproduct, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/putsubresource/202/200' @@ -1362,24 +1296,20 @@ class lr_osOperations(object): def put_async_sub_resource( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running put request with sub resource. :param product: Sub Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: subproduct or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: subproduct or (subproduct, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/putsubresourceasync/202/200' @@ -1441,25 +1371,21 @@ class lr_osOperations(object): def delete_provisioning202_accepted200_succeeded( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’ - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/delete/provisioning/202/accepted/200/succeeded' @@ -1525,25 +1451,21 @@ class lr_osOperations(object): def delete_provisioning202_deleting_failed200( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’ - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/delete/provisioning/202/deleting/200/failed' @@ -1609,25 +1531,21 @@ class lr_osOperations(object): def delete_provisioning202_deletingcanceled200( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’ - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/delete/provisioning/202/deleting/200/canceled' @@ -1693,21 +1611,17 @@ class lr_osOperations(object): def delete204_succeeded( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running delete succeeds and returns right away - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/delete/204/succeeded' @@ -1755,24 +1669,20 @@ class lr_osOperations(object): def delete202_retry200( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’ - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/delete/202/retry/200' @@ -1832,24 +1742,20 @@ class lr_osOperations(object): def delete202_no_retry204( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’ - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/delete/202/noretry/204' @@ -1909,23 +1815,19 @@ class lr_osOperations(object): def delete_no_header_in_retry( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running delete request, service returns a location header in the initial request. Subsequent calls to operation status do not contain location header. - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/delete/noheader' @@ -1976,23 +1878,19 @@ class lr_osOperations(object): def delete_async_no_header_in_retry( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running delete request, service returns an Azure-AsyncOperation header in the initial request. Subsequent calls to operation status do not contain Azure-AsyncOperation header. - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/deleteasync/noheader/202/204' @@ -2043,23 +1941,19 @@ class lr_osOperations(object): def delete_async_retry_succeeded( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/deleteasync/retry/succeeded' @@ -2112,23 +2006,19 @@ class lr_osOperations(object): def delete_async_no_retry_succeeded( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/deleteasync/noretry/succeeded' @@ -2181,23 +2071,19 @@ class lr_osOperations(object): def delete_async_retry_failed( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/deleteasync/retry/failed' @@ -2250,23 +2136,19 @@ class lr_osOperations(object): def delete_async_retrycanceled( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/deleteasync/retry/canceled' @@ -2319,24 +2201,19 @@ class lr_osOperations(object): def post200_with_payload( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running post request, service returns a 202 to the initial request, with 'Location' header. Poll returns a 200 with a response body after success. - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: sku or (sku, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/post/payload/200' @@ -2393,25 +2270,21 @@ class lr_osOperations(object): def post202_retry200( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/post/202/retry/200' @@ -2470,26 +2343,22 @@ class lr_osOperations(object): def post202_no_retry204( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running post request, service returns a 202 to the initial request, with 'Location' header, 204 with noresponse body after success :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/post/202/noretry/204' @@ -2556,27 +2425,23 @@ class lr_osOperations(object): def post_async_retry_succeeded( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/postasync/retry/succeeded' @@ -2644,27 +2509,23 @@ class lr_osOperations(object): def post_async_no_retry_succeeded( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/postasync/noretry/succeeded' @@ -2732,26 +2593,22 @@ class lr_osOperations(object): def post_async_retry_failed( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/postasync/retry/failed' @@ -2811,26 +2668,22 @@ class lr_osOperations(object): def post_async_retrycanceled( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/postasync/retry/canceled' diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/operations/lro_retrys_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/operations/lro_retrys_operations.py index 439ad0ee3..ab4e8c3ff 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/operations/lro_retrys_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/operations/lro_retrys_operations.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -18,7 +18,7 @@ import uuid from .. import models -class lro_retrysOperations(object): +class LRORetrysOperations(object): def __init__(self, client, config, serializer, derserializer): @@ -31,27 +31,23 @@ class lro_retrysOperations(object): def put201_creating_succeeded200( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running put request, service returns a 500, then a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’ :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/retryerror/put/201/creating/succeeded/200' @@ -115,27 +111,23 @@ class lro_retrysOperations(object): def put_async_relative_retry_succeeded( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running put request, service returns a 500, then a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/retryerror/putasync/retry/succeeded' @@ -203,25 +195,21 @@ class lro_retrysOperations(object): def delete_provisioning202_accepted200_succeeded( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running delete request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’ - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/retryerror/delete/provisioning/202/accepted/200/succeeded' @@ -287,23 +275,19 @@ class lro_retrysOperations(object): def delete202_retry200( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running delete request, service returns a 500, then a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’ - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/retryerror/delete/202/retry/200' @@ -355,23 +339,19 @@ class lro_retrysOperations(object): def delete_async_relative_retry_succeeded( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running delete request, service returns a 500, then a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/retryerror/deleteasync/retry/succeeded' @@ -424,25 +404,21 @@ class lro_retrysOperations(object): def post202_retry200( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running post request, service returns a 500, then a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/retryerror/post/202/retry/200' @@ -501,26 +477,22 @@ class lro_retrysOperations(object): def post_async_relative_retry_succeeded( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running post request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/retryerror/postasync/retry/succeeded' diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/operations/lrosa_ds_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/operations/lrosa_ds_operations.py index 25d9f68cc..b507474a8 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/operations/lrosa_ds_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/operations/lrosa_ds_operations.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -18,7 +18,7 @@ import uuid from .. import models -class lrosa_dsOperations(object): +class LROSADsOperations(object): def __init__(self, client, config, serializer, derserializer): @@ -31,24 +31,20 @@ class lrosa_dsOperations(object): def put_non_retry400( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running put request, service returns a 400 to the initial request :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/nonretryerror/put/400' @@ -112,25 +108,21 @@ class lrosa_dsOperations(object): def put_non_retry201_creating400( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/nonretryerror/put/201/creating/400' @@ -194,26 +186,22 @@ class lrosa_dsOperations(object): def put_async_relative_retry400( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running put request, service returns a 200 with ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/nonretryerror/putasync/retry/400' @@ -281,21 +269,17 @@ class lrosa_dsOperations(object): def delete_non_retry400( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running delete request, service returns a 400 with an error body - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/nonretryerror/delete/400' @@ -347,22 +331,18 @@ class lrosa_dsOperations(object): def delete202_non_retry400( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running delete request, service returns a 202 with a location header - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/nonretryerror/delete/202/retry/400' @@ -414,23 +394,19 @@ class lrosa_dsOperations(object): def delete_async_relative_retry400( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/nonretryerror/deleteasync/retry/400' @@ -483,23 +459,19 @@ class lrosa_dsOperations(object): def post_non_retry400( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running post request, service returns a 400 with no error body :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/nonretryerror/post/400' @@ -558,23 +530,19 @@ class lrosa_dsOperations(object): def post202_non_retry400( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running post request, service returns a 202 with a location header :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/nonretryerror/post/202/retry/400' @@ -633,25 +601,21 @@ class lrosa_dsOperations(object): def post_async_relative_retry400( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running post request, service returns a 202 to the initial request Poll the endpoint indicated in the Azure-AsyncOperation header for operation status :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/nonretryerror/postasync/retry/400' @@ -711,25 +675,21 @@ class lrosa_dsOperations(object): def put_error201_no_provisioning_state_payload( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running put request, service returns a 201 to the initial request with no payload :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/error/put/201/noprovisioningstatepayload' @@ -793,27 +753,23 @@ class lrosa_dsOperations(object): def put_async_relative_retry_no_status( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/error/putasync/retry/nostatus' @@ -881,27 +837,23 @@ class lrosa_dsOperations(object): def put_async_relative_retry_no_status_payload( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/error/putasync/retry/nostatuspayload' @@ -969,22 +921,18 @@ class lrosa_dsOperations(object): def delete204_succeeded( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running delete request, service returns a 204 to the initial request, indicating success. - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/error/delete/204/nolocation' @@ -1032,23 +980,19 @@ class lrosa_dsOperations(object): def delete_async_relative_retry_no_status( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/error/deleteasync/retry/nostatus' @@ -1101,24 +1045,20 @@ class lrosa_dsOperations(object): def post202_no_location( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running post request, service returns a 202 to the initial request, without a location header. :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/error/post/202/nolocation' @@ -1177,26 +1117,22 @@ class lrosa_dsOperations(object): def post_async_relative_retry_no_payload( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/error/postasync/retry/nopayload' @@ -1256,25 +1192,21 @@ class lrosa_dsOperations(object): def put200_invalid_json( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running put request, service returns a 200 to the initial request, with an entity that is not a valid json :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/error/put/200/invalidjson' @@ -1336,26 +1268,22 @@ class lrosa_dsOperations(object): def put_async_relative_retry_invalid_header( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/error/putasync/retry/invalidheader' @@ -1423,27 +1351,23 @@ class lrosa_dsOperations(object): def put_async_relative_retry_invalid_json_polling( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/error/putasync/retry/invalidjsonpolling' @@ -1511,23 +1435,19 @@ class lrosa_dsOperations(object): def delete202_retry_invalid_header( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running delete request, service returns a 202 to the initial request receing a reponse with an invalid 'Location' and 'Retry-After' headers - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/error/delete/202/retry/invalidheader' @@ -1579,23 +1499,19 @@ class lrosa_dsOperations(object): def delete_async_relative_retry_invalid_header( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running delete request, service returns a 202 to the initial request. The endpoint indicated in the Azure-AsyncOperation header is invalid - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/error/deleteasync/retry/invalidheader' @@ -1648,23 +1564,19 @@ class lrosa_dsOperations(object): def delete_async_relative_retry_invalid_json_polling( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/error/deleteasync/retry/invalidjsonpolling' @@ -1717,24 +1629,20 @@ class lrosa_dsOperations(object): def post202_retry_invalid_header( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running post request, service returns a 202 to the initial request, with invalid 'Location' and 'Retry-After' headers. :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/error/post/202/retry/invalidheader' @@ -1793,25 +1701,21 @@ class lrosa_dsOperations(object): def post_async_relative_retry_invalid_header( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/error/postasync/retry/invalidheader' @@ -1871,26 +1775,22 @@ class lrosa_dsOperations(object): def post_async_relative_retry_invalid_json_polling( self, product=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status :param product: Product to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type product: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type product: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/lro/error/postasync/retry/invalidjsonpolling' diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/setup.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/setup.py index b97abfc11..4fe647d87 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/setup.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/setup.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -22,7 +22,7 @@ VERSION = "1.0.0" # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.10", "six >= 1.9", "certifi", "python-dateutil"] +REQUIRES = ["msrest>=0.0.1", "msrestazure>=0.0.1"] setup( name=NAME, diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/__init__.py index ebbb21556..e9b8e4ddf 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/api_client.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/api_client.py index 37a7625e2..2f75fef56 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/api_client.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/api_client.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -12,7 +12,7 @@ from msrest.service_client import ServiceClient from msrest import Serializer, Deserializer from msrestazure import AzureConfiguration -from .operations.paging_operations import pagingOperations +from .operations.paging_operations import PagingOperations from . import models @@ -46,5 +46,5 @@ class AutoRestPagingTestService(object): self._deserialize = Deserializer(client_models) self.config = config - self.paging = pagingOperations( + self.paging = PagingOperations( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/models/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/models/__init__.py index 9e58425fb..56727c5d1 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/models/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/models/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -12,11 +12,13 @@ from .product import Product from .product_properties import ProductProperties from .operation_result import OperationResult +from .paging_get_multiple_pages_options import PagingGetMultiplePagesOptions from .product_paged import ProductPaged __all__ = [ 'Product', 'ProductProperties', 'OperationResult', + 'PagingGetMultiplePagesOptions', 'ProductPaged', ] diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/models/operation_result.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/models/operation_result.py index c9e433c9e..3b1f80612 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/models/operation_result.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/models/operation_result.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/models/paging_get_multiple_pages_options.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/models/paging_get_multiple_pages_options.py new file mode 100644 index 000000000..a71d9f0d6 --- /dev/null +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/models/paging_get_multiple_pages_options.py @@ -0,0 +1,24 @@ +# 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 0.14.0.0 +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class PagingGetMultiplePagesOptions(Model): + + _required = [] + + def __init__(self, *args, **kwargs): + + self.maxresults = None + self.timeout = None + + super(PagingGetMultiplePagesOptions, self).__init__(*args, **kwargs) diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/models/product.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/models/product.py index c11d1220b..2a1c5e3df 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/models/product.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/models/product.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/models/product_paged.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/models/product_paged.py index dcd1d5605..cda646ff5 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/models/product_paged.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/models/product_paged.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/models/product_properties.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/models/product_properties.py index 6452a453c..f258d4449 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/models/product_properties.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/models/product_properties.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/operations/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/operations/__init__.py index 16a1e4834..6c68f8d86 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/operations/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/operations/__init__.py @@ -4,13 +4,13 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from .paging_operations import pagingOperations +from .paging_operations import PagingOperations __all__ = [ - 'pagingOperations', + 'PagingOperations', ] diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/operations/paging_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/operations/paging_operations.py index b9689a33f..fad8b1ca6 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/operations/paging_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/auto_rest_paging_test_service/operations/paging_operations.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -17,7 +17,7 @@ import uuid from .. import models -class pagingOperations(object): +class PagingOperations(object): def __init__(self, client, config, serializer, derserializer): @@ -31,22 +31,18 @@ class pagingOperations(object): def get_single_pages( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - A paging operation that finishes on the first call without a nextlink - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: productpaged or (productpaged, requests.response) or concurrent.futures.Future """ - def internal_paging(next_link=None, raw=False): if next_link is None: @@ -92,25 +88,32 @@ class pagingOperations(object): @async_request def get_multiple_pages( - self, client_request_id=None, custom_headers={}, raw=False, callback=None, **operation_config): + self, client_request_id=None, paging_get_multiple_pages_options=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - A paging operation that includes a nextLink that has 10 pages :param client_request_id: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type client_request_id: str or none + :param paging_get_multiple_pages_options: Additional parameters for + the operation + :type paging_get_multiple_pages_options: paginggetmultiplepagesoptions + or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type client_request_id: str or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: productpaged or (productpaged, requests.response) or concurrent.futures.Future """ + maxresults = None + if paging_get_multiple_pages_options is not None: + maxresults = paging_get_multiple_pages_options.maxresults + timeout = None + if paging_get_multiple_pages_options is not None: + timeout = paging_get_multiple_pages_options.timeout def internal_paging(next_link=None, raw=False): @@ -135,6 +138,10 @@ class pagingOperations(object): header_parameters['client-request-id'] = self._serialize.header("client_request_id", client_request_id, 'str') 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 maxresults is not None: + header_parameters['maxresults'] = self._serialize.header("maxresults", maxresults, 'int') + if timeout is not None: + header_parameters['timeout'] = self._serialize.header("timeout", timeout, 'int') # Construct and send request request = self._client.get(url, query_parameters) @@ -161,23 +168,19 @@ class pagingOperations(object): def get_multiple_pages_retry_first( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - A paging operation that fails on the first call with 500 and then retries and then get a response including a nextLink that has 10 pages - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: productpaged or (productpaged, requests.response) or concurrent.futures.Future """ - def internal_paging(next_link=None, raw=False): if next_link is None: @@ -225,24 +228,20 @@ class pagingOperations(object): def get_multiple_pages_retry_second( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The client should retry and finish all 10 pages eventually. - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: productpaged or (productpaged, requests.response) or concurrent.futures.Future """ - def internal_paging(next_link=None, raw=False): if next_link is None: @@ -290,22 +289,18 @@ class pagingOperations(object): def get_single_pages_failure( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - A paging operation that receives a 400 on the first call - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: productpaged or (productpaged, requests.response) or concurrent.futures.Future """ - def internal_paging(next_link=None, raw=False): if next_link is None: @@ -353,22 +348,18 @@ class pagingOperations(object): def get_multiple_pages_failure( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - A paging operation that receives a 400 on the second call - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: productpaged or (productpaged, requests.response) or concurrent.futures.Future """ - def internal_paging(next_link=None, raw=False): if next_link is None: @@ -416,22 +407,18 @@ class pagingOperations(object): def get_multiple_pages_failure_uri( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - A paging operation that receives an invalid nextLink - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: productpaged or (productpaged, requests.response) or concurrent.futures.Future """ - def internal_paging(next_link=None, raw=False): if next_link is None: diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/setup.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/setup.py index a09f4e4ee..750ceeab3 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/setup.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/setup.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -22,7 +22,7 @@ VERSION = "1.0.0" # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.10", "six >= 1.9", "certifi", "python-dateutil"] +REQUIRES = ["msrest>=0.0.1", "msrestazure>=0.0.1"] setup( name=NAME, diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/auto_rest_resource_flattening_test_service/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/auto_rest_resource_flattening_test_service/__init__.py index 0a23611c7..c1b5f8266 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/auto_rest_resource_flattening_test_service/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/auto_rest_resource_flattening_test_service/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/auto_rest_resource_flattening_test_service/api_client.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/auto_rest_resource_flattening_test_service/api_client.py index f06ebb4f4..653397b2b 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/auto_rest_resource_flattening_test_service/api_client.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/auto_rest_resource_flattening_test_service/api_client.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -53,23 +53,19 @@ class AutoRestResourceFlatteningTestService(object): def put_array( self, resource_array=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put External Resource as an Array :param resource_array: External Resource as an Array to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type resource_array: list or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type resource_array: list or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azure/resource-flatten/array' @@ -107,21 +103,17 @@ class AutoRestResourceFlatteningTestService(object): def get_array( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get External Resource as an Array - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azure/resource-flatten/array' @@ -159,23 +151,19 @@ class AutoRestResourceFlatteningTestService(object): def put_dictionary( self, resource_dictionary=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put External Resource as a Dictionary :param resource_dictionary: External Resource as a Dictionary to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type resource_dictionary: dict or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type resource_dictionary: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azure/resource-flatten/dictionary' @@ -213,22 +201,17 @@ class AutoRestResourceFlatteningTestService(object): def get_dictionary( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get External Resource as a Dictionary - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azure/resource-flatten/dictionary' @@ -266,24 +249,20 @@ class AutoRestResourceFlatteningTestService(object): def put_resource_collection( self, resource_complex_object=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put External Resource as a ResourceCollection :param resource_complex_object: External Resource as a ResourceCollection to put - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type resource_complex_object: resourcecollection or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type resource_complex_object: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/azure/resource-flatten/resourcecollection' @@ -321,22 +300,18 @@ class AutoRestResourceFlatteningTestService(object): def get_resource_collection( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get External Resource as a ResourceCollection - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: resourcecollection or (resourcecollection, requests.response) + or concurrent.futures.Future """ - # Construct URL url = '/azure/resource-flatten/resourcecollection' diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/auto_rest_resource_flattening_test_service/models/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/auto_rest_resource_flattening_test_service/models/__init__.py index 73fcbe2d1..6bf3c7e54 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/auto_rest_resource_flattening_test_service/models/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/auto_rest_resource_flattening_test_service/models/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/auto_rest_resource_flattening_test_service/models/error.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/auto_rest_resource_flattening_test_service/models/error.py index 1413fe073..d6b15c22e 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/auto_rest_resource_flattening_test_service/models/error.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/auto_rest_resource_flattening_test_service/models/error.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/auto_rest_resource_flattening_test_service/models/flattened_product.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/auto_rest_resource_flattening_test_service/models/flattened_product.py index 5ef1d795a..9fd6141db 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/auto_rest_resource_flattening_test_service/models/flattened_product.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/auto_rest_resource_flattening_test_service/models/flattened_product.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/auto_rest_resource_flattening_test_service/models/resource.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/auto_rest_resource_flattening_test_service/models/resource.py index 8250984fd..f4acb67a6 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/auto_rest_resource_flattening_test_service/models/resource.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/auto_rest_resource_flattening_test_service/models/resource.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/auto_rest_resource_flattening_test_service/models/resource_collection.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/auto_rest_resource_flattening_test_service/models/resource_collection.py index 7824a808f..bc0780b8f 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/auto_rest_resource_flattening_test_service/models/resource_collection.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/auto_rest_resource_flattening_test_service/models/resource_collection.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/setup.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/setup.py index bf50440c4..b0741cdcb 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/setup.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/ResourceFlattening/setup.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -22,7 +22,7 @@ VERSION = "1.0.0" # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.10", "six >= 1.9", "certifi", "python-dateutil"] +REQUIRES = ["msrest>=0.0.1", "msrestazure>=0.0.1"] setup( name=NAME, diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/setup.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/setup.py index 958ad0807..7ca1803f7 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/setup.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/setup.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -22,7 +22,7 @@ VERSION = "2015-05-01-preview" # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.10", "six >= 1.9", "certifi", "python-dateutil"] +REQUIRES = ["msrest>=0.0.1", "msrestazure>=0.0.1"] setup( name=NAME, diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/__init__.py index 3a4aafb09..e66d43193 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/api_client.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/api_client.py index 867e448d0..c764bc6c8 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/api_client.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/api_client.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -12,8 +12,8 @@ from msrest.service_client import ServiceClient from msrest import Serializer, Deserializer from msrestazure import AzureConfiguration -from .operations.storage_accounts_operations import storage_accountsOperations -from .operations.usage_operations import usageOperations +from .operations.storage_accounts_operations import StorageAccountsOperations +from .operations.usage_operations import UsageOperations from . import models @@ -51,7 +51,7 @@ class StorageManagementClient(object): self._deserialize = Deserializer(client_models) self.config = config - self.storage_accounts = storage_accountsOperations( + self.storage_accounts = StorageAccountsOperations( self._client, self.config, self._serialize, self._deserialize) - self.usage = usageOperations( + self.usage = UsageOperations( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/__init__.py index 417b91522..0e7326154 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/bar.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/bar.py index fa6994dfc..0e1524b3f 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/bar.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/bar.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/check_name_availability_result.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/check_name_availability_result.py index f9219e536..b79414614 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/check_name_availability_result.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/check_name_availability_result.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/custom_domain.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/custom_domain.py index 4fbf0c928..ca80bc622 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/custom_domain.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/custom_domain.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/endpoints.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/endpoints.py index 971ff7d75..b8036cfcb 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/endpoints.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/endpoints.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/enums.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/enums.py index ba0a0a52b..dbfee2b8e 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/enums.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/enums.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/foo.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/foo.py index 107702b34..10c121a48 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/foo.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/foo.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/resource.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/resource.py index 8e7dba5cb..f001fc868 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/resource.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/resource.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/storage_account.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/storage_account.py index 1380f3d75..8106c93df 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/storage_account.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/storage_account.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/storage_account_check_name_availability_parameters.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/storage_account_check_name_availability_parameters.py index 3a1eccd1d..5a22e0b80 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/storage_account_check_name_availability_parameters.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/storage_account_check_name_availability_parameters.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/storage_account_create_parameters.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/storage_account_create_parameters.py index c43d60736..86a46c431 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/storage_account_create_parameters.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/storage_account_create_parameters.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/storage_account_keys.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/storage_account_keys.py index 4a3f41080..58e9e2e45 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/storage_account_keys.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/storage_account_keys.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/storage_account_paged.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/storage_account_paged.py index 2b612a567..5c976cc54 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/storage_account_paged.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/storage_account_paged.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/storage_account_regenerate_key_parameters.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/storage_account_regenerate_key_parameters.py index 2d5051b2e..ab84a4307 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/storage_account_regenerate_key_parameters.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/storage_account_regenerate_key_parameters.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/storage_account_update_parameters.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/storage_account_update_parameters.py index 5ca9f795c..ee423bbc3 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/storage_account_update_parameters.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/storage_account_update_parameters.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/sub_resource.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/sub_resource.py index 4b3bafae9..df4989992 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/sub_resource.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/sub_resource.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/usage.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/usage.py index 972c00772..f3ed481b9 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/usage.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/usage.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/usage_list_result.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/usage_list_result.py index b1ff0ce9c..1bac8e183 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/usage_list_result.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/usage_list_result.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/usage_name.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/usage_name.py index 3a9f118a8..096ee9294 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/usage_name.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/models/usage_name.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/operations/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/operations/__init__.py index de1cee466..afa8922ad 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/operations/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/operations/__init__.py @@ -4,15 +4,15 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from .storage_accounts_operations import storage_accountsOperations -from .usage_operations import usageOperations +from .storage_accounts_operations import StorageAccountsOperations +from .usage_operations import UsageOperations __all__ = [ - 'storage_accountsOperations', - 'usageOperations', + 'StorageAccountsOperations', + 'UsageOperations', ] diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/operations/storage_accounts_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/operations/storage_accounts_operations.py index d3a079fee..cc9fd49a4 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/operations/storage_accounts_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/operations/storage_accounts_operations.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -19,7 +19,7 @@ import uuid from .. import models -class storage_accountsOperations(object): +class StorageAccountsOperations(object): def __init__(self, client, config, serializer, derserializer): @@ -33,26 +33,22 @@ class storage_accountsOperations(object): def check_name_availability( self, account_name, custom_headers={}, raw=False, callback=None, **operation_config): """ - Checks that account name is valid and is not in use. :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type account_name: storageaccountchecknameavailabilityparameters + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type account_name: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: checknameavailabilityresult or (checknameavailabilityresult, + requests.response) or concurrent.futures.Future """ - # Construct URL url = '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability' path_format_arguments = { @@ -98,7 +94,6 @@ class storage_accountsOperations(object): def create( self, resource_group_name, account_name, parameters, custom_headers={}, raw=False, callback=None, **operation_config): """ - Asynchronously creates a new storage account with the specified parameters. Existing accounts cannot be updated with this API and should instead use the Update Storage Account API. If an account is @@ -107,26 +102,23 @@ class storage_accountsOperations(object): :param resource_group_name: The name of the resource group within the user’s subscription. + :type resource_group_name: str :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + :type account_name: str :param parameters: The parameters to provide for the created account. - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type parameters: storageaccountcreateparameters + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type resource_group_name: str - :type account_name: str - :type parameters: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: storageaccount or (storageaccount, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}' path_format_arguments = { @@ -193,28 +185,24 @@ class storage_accountsOperations(object): def delete( self, resource_group_name, account_name, custom_headers={}, raw=False, callback=None, **operation_config): """ - Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user’s subscription. + :type resource_group_name: str :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type resource_group_name: str - :type account_name: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}' path_format_arguments = { @@ -252,31 +240,27 @@ class storage_accountsOperations(object): def get_properties( self, resource_group_name, account_name, custom_headers={}, raw=False, callback=None, **operation_config): """ - Returns the properties for the specified storage account including but not limited to name, account type, location, and account status. The ListKeys operation should be used to retrieve storage keys. :param resource_group_name: The name of the resource group within the user’s subscription. + :type resource_group_name: str :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type resource_group_name: str - :type account_name: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: storageaccount or (storageaccount, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}' path_format_arguments = { @@ -321,7 +305,6 @@ class storage_accountsOperations(object): def update( self, resource_group_name, account_name, parameters, custom_headers={}, raw=False, callback=None, **operation_config): """ - Updates the account type or tags for a storage account. It can also be used to add a custom domain (note that custom domains cannot be added via the Create operation). Only one custom domain is supported per @@ -335,27 +318,24 @@ class storage_accountsOperations(object): :param resource_group_name: The name of the resource group within the user’s subscription. + :type resource_group_name: str :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + :type account_name: str :param parameters: The parameters to update on the account. Note that only one property can be changed at a time using this API. - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type parameters: storageaccountupdateparameters + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type resource_group_name: str - :type account_name: str - :type parameters: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: storageaccount or (storageaccount, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}' path_format_arguments = { @@ -404,26 +384,22 @@ class storage_accountsOperations(object): def list_keys( self, resource_group_name, account_name, custom_headers={}, raw=False, callback=None, **operation_config): """ - Lists the access keys for the specified storage account. :param resource_group_name: The name of the resource group. + :type resource_group_name: str :param account_name: The name of the storage account. - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type account_name: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type resource_group_name: str - :type account_name: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: storageaccountkeys or (storageaccountkeys, requests.response) + or concurrent.futures.Future """ - # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys' path_format_arguments = { @@ -468,24 +444,20 @@ class storage_accountsOperations(object): def list( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: storageaccountpaged or (storageaccountpaged, + requests.response) or concurrent.futures.Future """ - def internal_paging(next_link=None, raw=False): if next_link is None: @@ -538,27 +510,23 @@ class storage_accountsOperations(object): def list_by_resource_group( self, resource_group_name, custom_headers={}, raw=False, callback=None, **operation_config): """ - Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. :param resource_group_name: The name of the resource group within the user’s subscription. - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type resource_group_name: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: storageaccountpaged or (storageaccountpaged, + requests.response) or concurrent.futures.Future """ - def internal_paging(next_link=None, raw=False): if next_link is None: @@ -612,32 +580,28 @@ class storage_accountsOperations(object): def regenerate_key( self, resource_group_name, account_name, key_name=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Regenerates the access keys for the specified storage account. :param resource_group_name: The name of the resource group within the user’s subscription. + :type resource_group_name: str :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + :type account_name: str :param key_name: Possible values for this property include: 'key1', 'key2'. - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type key_name: str or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type resource_group_name: str - :type account_name: str - :type key_name: str or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: storageaccountkeys or (storageaccountkeys, requests.response) + or concurrent.futures.Future """ - regenerate_key = models.StorageAccountRegenerateKeyParameters() if key_name is not None: regenerate_key.key_name = key_name diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/operations/usage_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/operations/usage_operations.py index a64dffb60..e75887edc 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/operations/usage_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storage_management_client/operations/usage_operations.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -17,7 +17,7 @@ import uuid from .. import models -class usageOperations(object): +class UsageOperations(object): def __init__(self, client, config, serializer, derserializer): @@ -31,23 +31,19 @@ class usageOperations(object): def list( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Gets the current usage count and the limit for the resources under the subscription. - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: usagelistresult or (usagelistresult, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/usages' path_format_arguments = { diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoft_azure_test_url/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoft_azure_test_url/__init__.py index 712b589d1..e18cee820 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoft_azure_test_url/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoft_azure_test_url/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoft_azure_test_url/api_client.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoft_azure_test_url/api_client.py index 227cf89f8..25ea316de 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoft_azure_test_url/api_client.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoft_azure_test_url/api_client.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -12,7 +12,7 @@ from msrest.service_client import ServiceClient from msrest import Serializer, Deserializer from msrestazure import AzureConfiguration -from .operations.group_operations import groupOperations +from .operations.group_operations import GroupOperations from . import models @@ -50,5 +50,5 @@ class MicrosoftAzureTestUrl(object): self._deserialize = Deserializer(client_models) self.config = config - self.group = groupOperations( + self.group = GroupOperations( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoft_azure_test_url/models/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoft_azure_test_url/models/__init__.py index 7fb6ffc66..ab0f7f000 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoft_azure_test_url/models/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoft_azure_test_url/models/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoft_azure_test_url/models/error.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoft_azure_test_url/models/error.py index 5f60d4980..2e0fe27ef 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoft_azure_test_url/models/error.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoft_azure_test_url/models/error.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoft_azure_test_url/models/sample_resource_group.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoft_azure_test_url/models/sample_resource_group.py index 01aa44265..16d7ec836 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoft_azure_test_url/models/sample_resource_group.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoft_azure_test_url/models/sample_resource_group.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoft_azure_test_url/operations/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoft_azure_test_url/operations/__init__.py index bdc42af84..5e5af4363 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoft_azure_test_url/operations/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoft_azure_test_url/operations/__init__.py @@ -4,13 +4,13 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from .group_operations import groupOperations +from .group_operations import GroupOperations __all__ = [ - 'groupOperations', + 'GroupOperations', ] diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoft_azure_test_url/operations/group_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoft_azure_test_url/operations/group_operations.py index efc229d9e..316c6ff52 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoft_azure_test_url/operations/group_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoft_azure_test_url/operations/group_operations.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -16,7 +16,7 @@ import uuid from .. import models -class groupOperations(object): +class GroupOperations(object): def __init__(self, client, config, serializer, derserializer): @@ -30,25 +30,21 @@ class groupOperations(object): def get_sample_resource_group( self, resource_group_name, custom_headers={}, raw=False, callback=None, **operation_config): """ - Provides a resouce group with name 'testgroup101' and location 'West US'. :param resource_group_name: Resource Group name 'testgroup101'. - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type resource_group_name: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: sampleresourcegroup or (sampleresourcegroup, + requests.response) or concurrent.futures.Future """ - # Construct URL url = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}' path_format_arguments = { diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/setup.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/setup.py index 27d3b7c8e..350da9bc7 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/setup.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/setup.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -22,7 +22,7 @@ VERSION = "2014-04-01-preview" # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.10", "six >= 1.9", "certifi", "python-dateutil"] +REQUIRES = ["msrest>=0.0.1", "msrestazure>=0.0.1"] setup( name=NAME, diff --git a/AutoRest/Generators/Python/Azure.Python/AzurePythonCodeGenerator.cs b/AutoRest/Generators/Python/Azure.Python/AzurePythonCodeGenerator.cs index 1beb2ac31..b19245e41 100644 --- a/AutoRest/Generators/Python/Azure.Python/AzurePythonCodeGenerator.cs +++ b/AutoRest/Generators/Python/Azure.Python/AzurePythonCodeGenerator.cs @@ -185,96 +185,88 @@ namespace Microsoft.Rest.Generator.Azure.Python /// public override async Task Generate(ServiceClient serviceClient) { - try + var serviceClientTemplateModel = new AzureServiceClientTemplateModel(serviceClient); + + if (Settings.CustomSettings.ContainsKey("Version")) { - var serviceClientTemplateModel = new AzureServiceClientTemplateModel(serviceClient); + serviceClientTemplateModel.Version = Settings.CustomSettings["Version"]; + } - if (Settings.CustomSettings.ContainsKey("Version")) - { - serviceClientTemplateModel.Version = Settings.CustomSettings["Version"]; - } + // Service client + var setupTemplate = new SetupTemplate + { + Model = serviceClientTemplateModel + }; + await Write(setupTemplate, "setup.py"); - // Service client - var setupTemplate = new SetupTemplate + var serviceClientInitTemplate = new ServiceClientInitTemplate + { + Model = serviceClientTemplateModel + }; + await Write(serviceClientInitTemplate, Path.Combine(serviceClient.Name.ToPythonCase(), "__init__.py")); + + var serviceClientTemplate = new AzureServiceClientTemplate + { + Model = serviceClientTemplateModel, + }; + await Write(serviceClientTemplate, Path.Combine(serviceClient.Name.ToPythonCase(), "api_client.py")); + + //Models + if (serviceClientTemplateModel.ModelTemplateModels.Any()) + { + var modelInitTemplate = new AzureModelInitTemplate { - Model = serviceClientTemplateModel + Model = new AzureModelInitTemplateModel(serviceClient, pageModels.Select(t => t.TypeDefinitionName)) }; - await Write(setupTemplate, "setup.py"); + await Write(modelInitTemplate, Path.Combine(serviceClient.Name.ToPythonCase(), "models", "__init__.py")); - var serviceClientInitTemplate = new ServiceClientInitTemplate + foreach (var modelType in serviceClientTemplateModel.ModelTemplateModels) { - Model = serviceClientTemplateModel - }; - await Write(serviceClientInitTemplate, Path.Combine(serviceClient.Name.ToPythonCase(), "__init__.py")); - - var serviceClientTemplate = new AzureServiceClientTemplate - { - Model = serviceClientTemplateModel, - }; - await Write(serviceClientTemplate, Path.Combine(serviceClient.Name.ToPythonCase(), "api_client.py")); - - //Models - if (serviceClientTemplateModel.ModelTemplateModels.Any()) - { - var modelInitTemplate = new AzureModelInitTemplate + var modelTemplate = new ModelTemplate { - Model = new AzureModelInitTemplateModel(serviceClient, pageModels.Select(t => t.TypeDefinitionName)) + Model = modelType }; - await Write(modelInitTemplate, Path.Combine(serviceClient.Name.ToPythonCase(), "models", "__init__.py")); - - foreach (var modelType in serviceClientTemplateModel.ModelTemplateModels) - { - var modelTemplate = new ModelTemplate - { - Model = modelType - }; - await Write(modelTemplate, Path.Combine(serviceClient.Name.ToPythonCase(), "models", modelType.Name.ToPythonCase() + ".py")); - } - } - - //MethodGroups - if (serviceClientTemplateModel.MethodGroupModels.Any()) - { - var methodGroupIndexTemplate = new MethodGroupInitTemplate - { - Model = serviceClientTemplateModel - }; - await Write(methodGroupIndexTemplate, Path.Combine(serviceClient.Name.ToPythonCase(), "operations", "__init__.py")); - - foreach (var methodGroupModel in serviceClientTemplateModel.MethodGroupModels) - { - var methodGroupTemplate = new AzureMethodGroupTemplate - { - Model = methodGroupModel as AzureMethodGroupTemplateModel - }; - await Write(methodGroupTemplate, Path.Combine(serviceClient.Name.ToPythonCase(), "operations", methodGroupModel.MethodGroupType.ToPythonCase() + ".py")); - } - } - - // Enums - if (serviceClient.EnumTypes.Any()) - { - var enumTemplate = new EnumTemplate - { - Model = new EnumTemplateModel(serviceClient.EnumTypes), - }; - await Write(enumTemplate, Path.Combine(serviceClient.Name.ToPythonCase(), "models", "enums.py")); - } - - // Page class - foreach (var pageModel in pageModels) - { - var pageTemplate = new PageTemplate - { - Model = pageModel - }; - await Write(pageTemplate, Path.Combine(serviceClient.Name.ToPythonCase(), "models", pageModel.TypeDefinitionName.ToPythonCase() + ".py")); + await Write(modelTemplate, Path.Combine(serviceClient.Name.ToPythonCase(), "models", modelType.Name.ToPythonCase() + ".py")); } } - catch (Exception ex) + + //MethodGroups + if (serviceClientTemplateModel.MethodGroupModels.Any()) { - Console.WriteLine(ex.Message); - throw; + var methodGroupIndexTemplate = new MethodGroupInitTemplate + { + Model = serviceClientTemplateModel + }; + await Write(methodGroupIndexTemplate, Path.Combine(serviceClient.Name.ToPythonCase(), "operations", "__init__.py")); + + foreach (var methodGroupModel in serviceClientTemplateModel.MethodGroupModels) + { + var methodGroupTemplate = new AzureMethodGroupTemplate + { + Model = methodGroupModel as AzureMethodGroupTemplateModel + }; + await Write(methodGroupTemplate, Path.Combine(serviceClient.Name.ToPythonCase(), "operations", methodGroupModel.MethodGroupType.ToPythonCase() + ".py")); + } + } + + // Enums + if (serviceClient.EnumTypes.Any()) + { + var enumTemplate = new EnumTemplate + { + Model = new EnumTemplateModel(serviceClient.EnumTypes), + }; + await Write(enumTemplate, Path.Combine(serviceClient.Name.ToPythonCase(), "models", "enums.py")); + } + + // Page class + foreach (var pageModel in pageModels) + { + var pageTemplate = new PageTemplate + { + Model = pageModel + }; + await Write(pageTemplate, Path.Combine(serviceClient.Name.ToPythonCase(), "models", pageModel.TypeDefinitionName.ToPythonCase() + ".py")); } } } diff --git a/AutoRest/Generators/Python/Azure.Python/AzurePythonCodeNamer.cs b/AutoRest/Generators/Python/Azure.Python/AzurePythonCodeNamer.cs index 8a12e6646..d96e468bc 100644 --- a/AutoRest/Generators/Python/Azure.Python/AzurePythonCodeNamer.cs +++ b/AutoRest/Generators/Python/Azure.Python/AzurePythonCodeNamer.cs @@ -1,11 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -using System; using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using Microsoft.Rest.Generator.Azure; using Microsoft.Rest.Generator.ClientModel; using Microsoft.Rest.Generator.Python; diff --git a/AutoRest/Generators/Python/Azure.Python/TemplateModels/AzureServiceClientTemplateModel.cs b/AutoRest/Generators/Python/Azure.Python/TemplateModels/AzureServiceClientTemplateModel.cs index a46041b6a..f7085e83d 100644 --- a/AutoRest/Generators/Python/Azure.Python/TemplateModels/AzureServiceClientTemplateModel.cs +++ b/AutoRest/Generators/Python/Azure.Python/TemplateModels/AzureServiceClientTemplateModel.cs @@ -87,5 +87,12 @@ namespace Microsoft.Rest.Generator.Azure.Python } } + public override string SetupRequires + { + get + { + return "\"msrest>=0.0.1\", \"msrestazure>=0.0.1\""; + } + } } } \ No newline at end of file diff --git a/AutoRest/Generators/Python/Azure.Python/Templates/AzureLongRunningMethodTemplate.cshtml b/AutoRest/Generators/Python/Azure.Python/Templates/AzureLongRunningMethodTemplate.cshtml index 774f785a4..e0b698bb7 100644 --- a/AutoRest/Generators/Python/Azure.Python/Templates/AzureLongRunningMethodTemplate.cshtml +++ b/AutoRest/Generators/Python/Azure.Python/Templates/AzureLongRunningMethodTemplate.cshtml @@ -8,37 +8,31 @@ @inherits Microsoft.Rest.Generator.Template def @(Model.Name.ToPythonCase())( self, @(Model.MethodParameterDeclaration(Model.AddCustomHeader))): - """ @*need to fix comment here for long running function*@ @if (!String.IsNullOrEmpty(Model.Summary)) { -@: @WrapComment(string.Empty, Model.Summary) +@: """@WrapComment(string.Empty, Model.Summary) +} +else +{ +@: """ } @if (!String.IsNullOrEmpty(Model.Description)) { -@EmptyLine @: @WrapComment(string.Empty, Model.Description) } @EmptyLine @foreach(var parameter in Model.DocumentationParameters) { @: @WrapComment(string.Empty, ":param " + parameter.Name + ": " + parameter.Documentation) - } - @WrapComment(string.Empty, ":param custom_headers: headers that will be added to the request") - @WrapComment(string.Empty, ":param raw: returns the direct response alongside the deserialized response") - @WrapComment(string.Empty, ":param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future") - @foreach (var parameter in Model.DocumentationParameters) - { @: @WrapComment(string.Empty, ":type " + parameter.Name + ": " + MethodTemplateModel.GetDocumentationType(parameter.Type, parameter.IsRequired)) } - @WrapComment(string.Empty, ":type custom_headers: dict") - @WrapComment(string.Empty, ":type raw: boolean") + @WrapComment(string.Empty, ":param dict custom_headers: headers that will be added to the request") + @WrapComment(string.Empty, ":param boolean raw: returns the direct response alongside the deserialized response") + @WrapComment(string.Empty, ":param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future") @WrapComment(string.Empty, ":type callback: Callable[[concurrent.futures.Future], None] or None") - @WrapComment(string.Empty, string.Format(":rtype: {0} or ({0}, requests.response) or concurrent.futures.Future", MethodTemplateModel.GetDocumentationType(Model.ReturnType.Body))) - """ -@EmptyLine @Model.BuildInputMappings() @if (Model.InputParameterTransformation.Any()) { @@ -54,7 +48,7 @@ @EmptyLine # Construct headers header_parameters = {} - header_parameters['Content-Type'] = '@(Model.ContentType)' + header_parameters['Content-Type'] = '@(Model.RequestContentType)' @(Model.SetDefaultHeaders) @(Model.BuildHeaders("header_parameters")) @EmptyLine diff --git a/AutoRest/Generators/Python/Azure.Python/Templates/AzurePagingMethodTemplate.cshtml b/AutoRest/Generators/Python/Azure.Python/Templates/AzurePagingMethodTemplate.cshtml index 3e3960997..af97958be 100644 --- a/AutoRest/Generators/Python/Azure.Python/Templates/AzurePagingMethodTemplate.cshtml +++ b/AutoRest/Generators/Python/Azure.Python/Templates/AzurePagingMethodTemplate.cshtml @@ -9,14 +9,16 @@ @@async_request def @(Model.Name.ToPythonCase())( self, @(Model.MethodParameterDeclaration(true))): - """ @if (!String.IsNullOrEmpty(Model.Summary)) { -@: @WrapComment(string.Empty, Model.Summary) +@: """@WrapComment(string.Empty, Model.Summary) +} +else +{ +@: """ } @if (!String.IsNullOrEmpty(Model.Description)) { -@EmptyLine @: @WrapComment(string.Empty, Model.Description) } @EmptyLine @@ -24,22 +26,14 @@ @foreach(var parameter in Model.DocumentationParameters) { @: @WrapComment(string.Empty, ":param " + parameter.Name + ": " + parameter.Documentation) - } - @WrapComment(string.Empty, ":param custom_headers: headers that will be added to the request") - @WrapComment(string.Empty, ":param raw: returns the direct response alongside the deserialized response") - @WrapComment(string.Empty, ":param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future") - @foreach (var parameter in Model.DocumentationParameters) - { @: @WrapComment(string.Empty, ":type " + parameter.Name + ": " + MethodTemplateModel.GetDocumentationType(parameter.Type, parameter.IsRequired)) } - @WrapComment(string.Empty, ":type custom_headers: dict") - @WrapComment(string.Empty, ":type raw: boolean") + @WrapComment(string.Empty, ":param dict custom_headers: headers that will be added to the request") + @WrapComment(string.Empty, ":param boolean raw: returns the direct response alongside the deserialized response") + @WrapComment(string.Empty, ":param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future") @WrapComment(string.Empty, ":type callback: Callable[[concurrent.futures.Future], None] or None") - @WrapComment(string.Empty, string.Format(":rtype: {0} or ({0}, requests.response) or concurrent.futures.Future", MethodTemplateModel.GetDocumentationType(Model.ReturnType.Body))) - """ -@EmptyLine @Model.BuildInputMappings() @if (Model.InputParameterTransformation.Any()) { @@ -62,7 +56,7 @@ @EmptyLine # Construct headers header_parameters = {} - header_parameters['Content-Type'] = '@(Model.ContentType)' + header_parameters['Content-Type'] = '@(Model.RequestContentType)' @(Model.SetDefaultHeaders) @(Model.BuildHeaders("header_parameters")) @EmptyLine diff --git a/AutoRest/Generators/Python/Azure.Python/Templates/AzureServiceClientTemplate.cshtml b/AutoRest/Generators/Python/Azure.Python/Templates/AzureServiceClientTemplate.cshtml index 87343c653..ba559ca21 100644 --- a/AutoRest/Generators/Python/Azure.Python/Templates/AzureServiceClientTemplate.cshtml +++ b/AutoRest/Generators/Python/Azure.Python/Templates/AzureServiceClientTemplate.cshtml @@ -84,7 +84,7 @@ else self.config = config @foreach (var methodGroup in Model.MethodGroupModels) { - @:self.@(methodGroup.MethodGroupName) = @(methodGroup.MethodGroupType)( + @:self.@(methodGroup.MethodGroupName.ToPythonCase()) = @(methodGroup.MethodGroupType)( @:self._client, self.config, self._serialize, self._deserialize) } @foreach (var method in Model.MethodTemplateModels) diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/complex_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/complex_tests.py index 20789b695..58d2b6b86 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/complex_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/complex_tests.py @@ -45,32 +45,32 @@ class ComplexTests(unittest.TestCase): client = AutoRestComplexTestService(config) # GET basic/valid - basic_result = client.basicOperations.get_valid() + basic_result = client.basic_operations.get_valid() self.assertEqual(2, basic_result.id) self.assertEqual("abc", basic_result.name); self.assertEqual(CMYKColors.yellow, basic_result.color); # PUT basic/valid basic_result = Basic(id=2, name='abc', color=CMYKColors.magenta) - client.basicOperations.put_valid(basic_result) + client.basic_operations.put_valid(basic_result) # GET basic/empty - basic_result = client.basicOperations.get_empty() + basic_result = client.basic_operations.get_empty() self.assertIsNone(basic_result.id) self.assertIsNone(basic_result.name) # GET basic/null - basic_result = client.basicOperations.get_null() + basic_result = client.basic_operations.get_null() self.assertIsNone(basic_result.id) self.assertIsNone(basic_result.name) # GET basic/notprovided - basic_result = client.basicOperations.get_not_provided() + basic_result = client.basic_operations.get_not_provided() self.assertIsNone(basic_result) # GET basic/invalid with self.assertRaises(DeserializationError): - client.basicOperations.get_invalid() + client.basic_operations.get_invalid() """ COMPLEX TYPE WITH PRIMITIVE PROPERTIES diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/form_data_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/form_data_tests.py new file mode 100644 index 000000000..c9f329fbb --- /dev/null +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/form_data_tests.py @@ -0,0 +1,41 @@ +import unittest +import subprocess +import sys +import isodate +import os +from os.path import dirname, pardir, join, realpath, sep, pardir + +cwd = dirname(realpath(__file__)) +root = realpath(join(cwd , pardir, pardir, pardir, pardir, pardir)) +sys.path.append(join(root, "ClientRuntimes" , "Python", "msrest")) +log_level = int(os.environ.get('PythonLogLevel', 30)) + +tests = realpath(join(cwd, pardir, "Expected", "AcceptanceTests")) +sys.path.append(join(tests, "BodyFormData")) + +from msrest.exceptions import DeserializationError + +from auto_rest_swagger_bat_form_data_service import AutoRestSwaggerBATFormDataService, AutoRestSwaggerBATFormDataServiceConfiguration + +class FormDataTests(unittest.TestCase): + + def test_file_upload_stream(self): + + config = AutoRestSwaggerBATFormDataServiceConfiguration(base_url="http://localhost:3000") + config.log_level = log_level + client = AutoRestSwaggerBATFormDataService(config) + + def test_file_upload_file_stream(self): + + config = AutoRestSwaggerBATFormDataServiceConfiguration(base_url="http://localhost:3000") + config.log_level = log_level + client = AutoRestSwaggerBATFormDataService(config) + + def test_file_upload(self): + + config = AutoRestSwaggerBATFormDataServiceConfiguration(base_url="http://localhost:3000") + config.log_level = log_level + client = AutoRestSwaggerBATFormDataService(config) + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/zzz_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/zzz_tests.py index ca2d67e82..10791f3fc 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/zzz_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/zzz_tests.py @@ -34,6 +34,11 @@ class AcceptanceTests(unittest.TestCase): report['getDateInvalid']=1 report['getDictionaryNullkey']=1 report['HttpRedirect300Get']=1 + + # BUG!!! Need implement these test cases + report['StreamUploadFile']=1 + report['FormdataStreamUploadFile']=1 + skipped = [k for k, v in report.items() if v == 0] for s in skipped: diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/auto_rest_swagger_bat_array_service/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/auto_rest_swagger_bat_array_service/__init__.py index 5299733e7..f770b6652 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/auto_rest_swagger_bat_array_service/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/auto_rest_swagger_bat_array_service/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/auto_rest_swagger_bat_array_service/api_client.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/auto_rest_swagger_bat_array_service/api_client.py index 1f8c4bab3..ef286f41f 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/auto_rest_swagger_bat_array_service/api_client.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/auto_rest_swagger_bat_array_service/api_client.py @@ -4,14 +4,14 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- from msrest.service_client import ServiceClient from msrest import Configuration, Serializer, Deserializer -from .operations.array import array +from .operations.array import Array from . import models @@ -39,5 +39,5 @@ class AutoRestSwaggerBATArrayService(object): self._deserialize = Deserializer(client_models) self.config = config - self.array = array( + self.array = Array( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/auto_rest_swagger_bat_array_service/models/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/auto_rest_swagger_bat_array_service/models/__init__.py index fedd7dfe6..e985973a5 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/auto_rest_swagger_bat_array_service/models/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/auto_rest_swagger_bat_array_service/models/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/auto_rest_swagger_bat_array_service/models/error.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/auto_rest_swagger_bat_array_service/models/error.py index 1413fe073..d6b15c22e 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/auto_rest_swagger_bat_array_service/models/error.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/auto_rest_swagger_bat_array_service/models/error.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/auto_rest_swagger_bat_array_service/models/product.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/auto_rest_swagger_bat_array_service/models/product.py index 27236de9b..012b0cd45 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/auto_rest_swagger_bat_array_service/models/product.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/auto_rest_swagger_bat_array_service/models/product.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/auto_rest_swagger_bat_array_service/operations/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/auto_rest_swagger_bat_array_service/operations/__init__.py index e84cae9e1..e3b708562 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/auto_rest_swagger_bat_array_service/operations/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/auto_rest_swagger_bat_array_service/operations/__init__.py @@ -4,13 +4,13 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from .array import array +from .array import Array __all__ = [ - 'array', + 'Array', ] diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/auto_rest_swagger_bat_array_service/operations/array.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/auto_rest_swagger_bat_array_service/operations/array.py index 3211e1f57..1c58ffa1a 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/auto_rest_swagger_bat_array_service/operations/array.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/auto_rest_swagger_bat_array_service/operations/array.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class array(object): +class Array(object): def __init__(self, client, config, serializer, derserializer): @@ -29,21 +29,17 @@ class array(object): def get_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get null array value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/null' @@ -78,21 +74,17 @@ class array(object): def get_invalid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get invalid array [1, 2, 3 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/invalid' @@ -127,21 +119,17 @@ class array(object): def get_empty( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get empty array value [] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/empty' @@ -176,23 +164,19 @@ class array(object): def put_empty( self, array_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Set array value empty [] :param array_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_body: list + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_body: list - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/empty' @@ -224,21 +208,17 @@ class array(object): def get_boolean_tfft( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get boolean array value [true, false, false, true] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/boolean/tfft' @@ -273,23 +253,19 @@ class array(object): def put_boolean_tfft( self, array_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Set array value empty [true, false, false, true] :param array_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_body: list + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_body: list - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/boolean/tfft' @@ -321,21 +297,17 @@ class array(object): def get_boolean_invalid_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get boolean array value [true, null, false] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/boolean/true.null.false' @@ -370,21 +342,17 @@ class array(object): def get_boolean_invalid_string( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get boolean array value [true, 'boolean', false] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/boolean/true.boolean.false' @@ -419,21 +387,17 @@ class array(object): def get_integer_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get integer array value [1, -1, 3, 300] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/integer/1.-1.3.300' @@ -468,23 +432,19 @@ class array(object): def put_integer_valid( self, array_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Set array value empty [1, -1, 3, 300] :param array_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_body: list + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_body: list - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/integer/1.-1.3.300' @@ -516,21 +476,17 @@ class array(object): def get_int_invalid_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get integer array value [1, null, 0] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/integer/1.null.zero' @@ -565,21 +521,17 @@ class array(object): def get_int_invalid_string( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get integer array value [1, 'integer', 0] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/integer/1.integer.0' @@ -614,21 +566,17 @@ class array(object): def get_long_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get integer array value [1, -1, 3, 300] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/long/1.-1.3.300' @@ -663,23 +611,19 @@ class array(object): def put_long_valid( self, array_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Set array value empty [1, -1, 3, 300] :param array_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_body: list + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_body: list - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/long/1.-1.3.300' @@ -711,21 +655,17 @@ class array(object): def get_long_invalid_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get long array value [1, null, 0] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/long/1.null.zero' @@ -760,21 +700,17 @@ class array(object): def get_long_invalid_string( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get long array value [1, 'integer', 0] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/long/1.integer.0' @@ -809,21 +745,17 @@ class array(object): def get_float_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get float array value [0, -0.01, 1.2e20] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/float/0--0.01-1.2e20' @@ -858,23 +790,19 @@ class array(object): def put_float_valid( self, array_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Set array value [0, -0.01, 1.2e20] :param array_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_body: list + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_body: list - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/float/0--0.01-1.2e20' @@ -906,21 +834,17 @@ class array(object): def get_float_invalid_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get float array value [0.0, null, -1.2e20] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/float/0.0-null-1.2e20' @@ -955,21 +879,17 @@ class array(object): def get_float_invalid_string( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get boolean array value [1.0, 'number', 0.0] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/float/1.number.0' @@ -1004,21 +924,17 @@ class array(object): def get_double_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get float array value [0, -0.01, 1.2e20] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/double/0--0.01-1.2e20' @@ -1053,23 +969,19 @@ class array(object): def put_double_valid( self, array_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Set array value [0, -0.01, 1.2e20] :param array_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_body: list + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_body: list - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/double/0--0.01-1.2e20' @@ -1101,21 +1013,17 @@ class array(object): def get_double_invalid_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get float array value [0.0, null, -1.2e20] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/double/0.0-null-1.2e20' @@ -1150,21 +1058,17 @@ class array(object): def get_double_invalid_string( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get boolean array value [1.0, 'number', 0.0] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/double/1.number.0' @@ -1199,21 +1103,17 @@ class array(object): def get_string_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get string array value ['foo1', 'foo2', 'foo3'] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/string/foo1.foo2.foo3' @@ -1248,23 +1148,19 @@ class array(object): def put_string_valid( self, array_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Set array value ['foo1', 'foo2', 'foo3'] :param array_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_body: list + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_body: list - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/string/foo1.foo2.foo3' @@ -1296,21 +1192,17 @@ class array(object): def get_string_with_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get string array value ['foo', null, 'foo2'] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/string/foo.null.foo2' @@ -1345,21 +1237,17 @@ class array(object): def get_string_with_invalid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get string array value ['foo', 123, 'foo2'] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/string/foo.123.foo2' @@ -1394,21 +1282,17 @@ class array(object): def get_date_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get integer array value ['2000-12-01', '1980-01-02', '1492-10-12'] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/date/valid' @@ -1443,23 +1327,19 @@ class array(object): def put_date_valid( self, array_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Set array value ['2000-12-01', '1980-01-02', '1492-10-12'] :param array_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_body: list + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_body: list - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/date/valid' @@ -1491,21 +1371,17 @@ class array(object): def get_date_invalid_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get date array value ['2012-01-01', null, '1776-07-04'] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/date/invalidnull' @@ -1540,21 +1416,17 @@ class array(object): def get_date_invalid_chars( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get date array value ['2011-03-22', 'date'] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/date/invalidchars' @@ -1589,22 +1461,18 @@ class array(object): def get_date_time_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get date-time array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00'] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/date-time/valid' @@ -1639,24 +1507,20 @@ class array(object): def put_date_time_valid( self, array_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00'] :param array_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_body: list + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_body: list - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/date-time/valid' @@ -1688,21 +1552,17 @@ class array(object): def get_date_time_invalid_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get date array value ['2000-12-01t00:00:01z', null] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/date-time/invalidnull' @@ -1737,21 +1597,17 @@ class array(object): def get_date_time_invalid_chars( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get date array value ['2000-12-01t00:00:01z', 'date-time'] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/date-time/invalidchars' @@ -1786,22 +1642,18 @@ class array(object): def get_date_time_rfc1123_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get date-time array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT'] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/date-time-rfc1123/valid' @@ -1836,24 +1688,20 @@ class array(object): def put_date_time_rfc1123_valid( self, array_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT'] :param array_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_body: list + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_body: list - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/date-time-rfc1123/valid' @@ -1885,21 +1733,17 @@ class array(object): def get_duration_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get duration array value ['P123DT22H14M12.011S', 'P5DT1H0M0S'] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/duration/valid' @@ -1934,23 +1778,19 @@ class array(object): def put_duration_valid( self, array_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S'] :param array_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_body: list + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_body: list - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/duration/valid' @@ -1982,22 +1822,18 @@ class array(object): def get_byte_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get byte array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each item encoded in base64 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/byte/valid' @@ -2032,24 +1868,20 @@ class array(object): def put_byte_valid( self, array_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each elementencoded in base 64 :param array_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_body: list + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_body: list - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/byte/valid' @@ -2081,22 +1913,18 @@ class array(object): def get_byte_invalid_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get byte array value [hex(AB, AC, AD), null] with the first item base64 encoded - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/prim/byte/invalidnull' @@ -2131,21 +1959,17 @@ class array(object): def get_complex_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get array of complex type null value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/complex/null' @@ -2180,21 +2004,17 @@ class array(object): def get_complex_empty( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get empty array of complex type [] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/complex/empty' @@ -2229,22 +2049,18 @@ class array(object): def get_complex_item_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get array of complex type with null item [{'integer': 1 'string': '2'}, null, {'integer': 5, 'string': '6'}] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/complex/itemnull' @@ -2279,22 +2095,18 @@ class array(object): def get_complex_item_empty( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get array of complex type with empty item [{'integer': 1 'string': '2'}, {}, {'integer': 5, 'string': '6'}] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/complex/itemempty' @@ -2329,22 +2141,18 @@ class array(object): def get_complex_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get array of complex type with [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/complex/valid' @@ -2379,24 +2187,20 @@ class array(object): def put_complex_valid( self, array_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}] :param array_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_body: list + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_body: list - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/complex/valid' @@ -2428,21 +2232,17 @@ class array(object): def get_array_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get a null array - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/array/null' @@ -2477,21 +2277,17 @@ class array(object): def get_array_empty( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get an empty array [] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/array/empty' @@ -2526,22 +2322,18 @@ class array(object): def get_array_item_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get an array of array of strings [['1', '2', '3'], null, ['7', '8', '9']] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/array/itemnull' @@ -2576,21 +2368,17 @@ class array(object): def get_array_item_empty( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get an array of array of strings [['1', '2', '3'], [], ['7', '8', '9']] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/array/itemempty' @@ -2625,22 +2413,18 @@ class array(object): def get_array_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get an array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/array/valid' @@ -2675,24 +2459,20 @@ class array(object): def put_array_valid( self, array_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']] :param array_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_body: list + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_body: list - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/array/valid' @@ -2724,21 +2504,17 @@ class array(object): def get_dictionary_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get an array of Dictionaries with value null - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/dictionary/null' @@ -2773,21 +2549,17 @@ class array(object): def get_dictionary_empty( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get an array of Dictionaries of type with value [] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/dictionary/empty' @@ -2822,23 +2594,19 @@ class array(object): def get_dictionary_item_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, null, {'7': 'seven', '8': 'eight', '9': 'nine'}] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/dictionary/itemnull' @@ -2873,23 +2641,19 @@ class array(object): def get_dictionary_item_empty( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {}, {'7': 'seven', '8': 'eight', '9': 'nine'}] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/dictionary/itemempty' @@ -2924,23 +2688,19 @@ class array(object): def get_dictionary_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}] - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/dictionary/valid' @@ -2975,25 +2735,21 @@ class array(object): def put_dictionary_valid( self, array_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}] :param array_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_body: list + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_body: list - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/array/dictionary/valid' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/setup.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/setup.py index 3ced71364..0419763cc 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/setup.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/setup.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -22,7 +22,7 @@ VERSION = "1.0.0" # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.10", "six >= 1.9", "certifi", "python-dateutil"] +REQUIRES = ["msrest>=0.0.1"] setup( name=NAME, diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/auto_rest_bool_test_service/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/auto_rest_bool_test_service/__init__.py index 796e8e7e0..ae66f8dde 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/auto_rest_bool_test_service/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/auto_rest_bool_test_service/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/auto_rest_bool_test_service/api_client.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/auto_rest_bool_test_service/api_client.py index 1c7c3a80b..5aff2638d 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/auto_rest_bool_test_service/api_client.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/auto_rest_bool_test_service/api_client.py @@ -4,14 +4,14 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- from msrest.service_client import ServiceClient from msrest import Configuration, Serializer, Deserializer -from .operations.bool_model import bool_model +from .operations.bool_model import BoolModel from . import models @@ -39,5 +39,5 @@ class AutoRestBoolTestService(object): self._deserialize = Deserializer(client_models) self.config = config - self.bool_model = bool_model( + self.bool_model = BoolModel( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/auto_rest_bool_test_service/models/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/auto_rest_bool_test_service/models/__init__.py index 1448b1ade..279ee4c88 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/auto_rest_bool_test_service/models/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/auto_rest_bool_test_service/models/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/auto_rest_bool_test_service/models/error.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/auto_rest_bool_test_service/models/error.py index 1413fe073..d6b15c22e 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/auto_rest_bool_test_service/models/error.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/auto_rest_bool_test_service/models/error.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/auto_rest_bool_test_service/operations/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/auto_rest_bool_test_service/operations/__init__.py index 75fa1a9d5..d029dde4f 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/auto_rest_bool_test_service/operations/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/auto_rest_bool_test_service/operations/__init__.py @@ -4,13 +4,13 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from .bool_model import bool_model +from .bool_model import BoolModel __all__ = [ - 'bool_model', + 'BoolModel', ] diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/auto_rest_bool_test_service/operations/bool_model.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/auto_rest_bool_test_service/operations/bool_model.py index be58b72c2..0fb02e1f3 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/auto_rest_bool_test_service/operations/bool_model.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/auto_rest_bool_test_service/operations/bool_model.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class bool_model(object): +class BoolModel(object): def __init__(self, client, config, serializer, derserializer): @@ -29,21 +29,17 @@ class bool_model(object): def get_true( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get true Boolean value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: bool or (bool, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/bool/true' @@ -78,23 +74,19 @@ class bool_model(object): def put_true( self, bool_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Set Boolean value true :param bool_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type bool_body: bool + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type bool_body: bool - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/bool/true' @@ -126,21 +118,17 @@ class bool_model(object): def get_false( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get false Boolean value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: bool or (bool, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/bool/false' @@ -175,23 +163,19 @@ class bool_model(object): def put_false( self, bool_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Set Boolean value false :param bool_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type bool_body: bool + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type bool_body: bool - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/bool/false' @@ -223,21 +207,17 @@ class bool_model(object): def get_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get null Boolean value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: bool or (bool, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/bool/null' @@ -272,21 +252,17 @@ class bool_model(object): def get_invalid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get invalid Boolean value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: bool or (bool, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/bool/invalid' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/setup.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/setup.py index e2edae435..41a1f9105 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/setup.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/setup.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -22,7 +22,7 @@ VERSION = "1.0.0" # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.10", "six >= 1.9", "certifi", "python-dateutil"] +REQUIRES = ["msrest>=0.0.1"] setup( name=NAME, diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/auto_rest_swagger_bat_byte_service/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/auto_rest_swagger_bat_byte_service/__init__.py index a021cd9e7..f036c7402 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/auto_rest_swagger_bat_byte_service/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/auto_rest_swagger_bat_byte_service/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/auto_rest_swagger_bat_byte_service/api_client.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/auto_rest_swagger_bat_byte_service/api_client.py index e7b17ff32..1cc204256 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/auto_rest_swagger_bat_byte_service/api_client.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/auto_rest_swagger_bat_byte_service/api_client.py @@ -4,14 +4,14 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- from msrest.service_client import ServiceClient from msrest import Configuration, Serializer, Deserializer -from .operations.byte import byte +from .operations.byte import Byte from . import models @@ -39,5 +39,5 @@ class AutoRestSwaggerBATByteService(object): self._deserialize = Deserializer(client_models) self.config = config - self.byte = byte( + self.byte = Byte( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/auto_rest_swagger_bat_byte_service/models/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/auto_rest_swagger_bat_byte_service/models/__init__.py index 1448b1ade..279ee4c88 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/auto_rest_swagger_bat_byte_service/models/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/auto_rest_swagger_bat_byte_service/models/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/auto_rest_swagger_bat_byte_service/models/error.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/auto_rest_swagger_bat_byte_service/models/error.py index 1413fe073..d6b15c22e 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/auto_rest_swagger_bat_byte_service/models/error.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/auto_rest_swagger_bat_byte_service/models/error.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/auto_rest_swagger_bat_byte_service/operations/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/auto_rest_swagger_bat_byte_service/operations/__init__.py index f3a25aed6..4914ca492 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/auto_rest_swagger_bat_byte_service/operations/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/auto_rest_swagger_bat_byte_service/operations/__init__.py @@ -4,13 +4,13 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from .byte import byte +from .byte import Byte __all__ = [ - 'byte', + 'Byte', ] diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/auto_rest_swagger_bat_byte_service/operations/byte.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/auto_rest_swagger_bat_byte_service/operations/byte.py index f4b46570e..762492685 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/auto_rest_swagger_bat_byte_service/operations/byte.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/auto_rest_swagger_bat_byte_service/operations/byte.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class byte(object): +class Byte(object): def __init__(self, client, config, serializer, derserializer): @@ -29,22 +29,18 @@ class byte(object): def get_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get null byte value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: bytearray or (bytearray, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/byte/null' @@ -79,22 +75,18 @@ class byte(object): def get_empty( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get empty byte value '' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: bytearray or (bytearray, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/byte/empty' @@ -129,22 +121,18 @@ class byte(object): def get_non_ascii( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6) - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: bytearray or (bytearray, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/byte/nonAscii' @@ -179,24 +167,20 @@ class byte(object): def put_non_ascii( self, byte_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6) :param byte_body: Base64-encoded non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6) - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type byte_body: bytearray + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type byte_body: bytearray - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/byte/nonAscii' @@ -228,22 +212,18 @@ class byte(object): def get_invalid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get invalid byte value ':::SWAGGER::::' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: bytearray or (bytearray, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/byte/invalid' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/setup.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/setup.py index 14fd3f998..fbf63d915 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/setup.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/setup.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -22,7 +22,7 @@ VERSION = "1.0.0" # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.10", "six >= 1.9", "certifi", "python-dateutil"] +REQUIRES = ["msrest>=0.0.1"] setup( name=NAME, diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/__init__.py index 62a2f332a..c8198bc4c 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/api_client.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/api_client.py index 76a7374e5..25d078c2c 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/api_client.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/api_client.py @@ -4,20 +4,20 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- from msrest.service_client import ServiceClient from msrest import Configuration, Serializer, Deserializer -from .operations.basic_operations import basicOperations -from .operations.primitive import primitive -from .operations.array import array -from .operations.dictionary import dictionary -from .operations.inheritance import inheritance -from .operations.polymorphism import polymorphism -from .operations.polymorphicrecursive import polymorphicrecursive +from .operations.basic_operations import BasicOperations +from .operations.primitive import Primitive +from .operations.array import Array +from .operations.dictionary import Dictionary +from .operations.inheritance import Inheritance +from .operations.polymorphism import Polymorphism +from .operations.polymorphicrecursive import Polymorphicrecursive from . import models @@ -45,17 +45,17 @@ class AutoRestComplexTestService(object): self._deserialize = Deserializer(client_models) self.config = config - self.basicOperations = basicOperations( + self.basic_operations = BasicOperations( self._client, self.config, self._serialize, self._deserialize) - self.primitive = primitive( + self.primitive = Primitive( self._client, self.config, self._serialize, self._deserialize) - self.array = array( + self.array = Array( self._client, self.config, self._serialize, self._deserialize) - self.dictionary = dictionary( + self.dictionary = Dictionary( self._client, self.config, self._serialize, self._deserialize) - self.inheritance = inheritance( + self.inheritance = Inheritance( self._client, self.config, self._serialize, self._deserialize) - self.polymorphism = polymorphism( + self.polymorphism = Polymorphism( self._client, self.config, self._serialize, self._deserialize) - self.polymorphicrecursive = polymorphicrecursive( + self.polymorphicrecursive = Polymorphicrecursive( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/__init__.py index 27ac98c6f..8a29d525e 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/array_wrapper.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/array_wrapper.py index ac7e25e15..24495c468 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/array_wrapper.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/array_wrapper.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/basic.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/basic.py index b9d2a0082..760107ff7 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/basic.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/basic.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/boolean_wrapper.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/boolean_wrapper.py index ff55b636a..460ee7fb2 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/boolean_wrapper.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/boolean_wrapper.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/byte_wrapper.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/byte_wrapper.py index b80a7744d..7464f966f 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/byte_wrapper.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/byte_wrapper.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/cat.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/cat.py index 84109719f..c93ef88b7 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/cat.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/cat.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/cookiecuttershark.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/cookiecuttershark.py index a28ea89b4..451a6853c 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/cookiecuttershark.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/cookiecuttershark.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/date_wrapper.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/date_wrapper.py index 5c6b734ae..d9956a815 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/date_wrapper.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/date_wrapper.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/datetime_wrapper.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/datetime_wrapper.py index 843298754..9e7ec3596 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/datetime_wrapper.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/datetime_wrapper.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/datetimerfc1123_wrapper.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/datetimerfc1123_wrapper.py index 666d4956d..801c4a372 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/datetimerfc1123_wrapper.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/datetimerfc1123_wrapper.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/dictionary_wrapper.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/dictionary_wrapper.py index 838e840a3..4a4a1590d 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/dictionary_wrapper.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/dictionary_wrapper.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/dog.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/dog.py index eb5ffd555..8f8b5d936 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/dog.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/dog.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/double_wrapper.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/double_wrapper.py index 1f59eafd0..8e1823a28 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/double_wrapper.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/double_wrapper.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/duration_wrapper.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/duration_wrapper.py index 377d3e406..41e25b3bf 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/duration_wrapper.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/duration_wrapper.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/enums.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/enums.py index e8140e548..acaddfe63 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/enums.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/enums.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/error.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/error.py index 1413fe073..d6b15c22e 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/error.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/error.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/fish.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/fish.py index e1a8c08bb..d632fa3d5 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/fish.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/fish.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/float_wrapper.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/float_wrapper.py index 4fa5c1cca..8439a5db5 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/float_wrapper.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/float_wrapper.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/goblinshark.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/goblinshark.py index 2caf2882e..3cf978574 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/goblinshark.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/goblinshark.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/int_wrapper.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/int_wrapper.py index c6d2295c3..a4a27cc42 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/int_wrapper.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/int_wrapper.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/long_wrapper.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/long_wrapper.py index 5e39c68e0..0196337e7 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/long_wrapper.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/long_wrapper.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/pet.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/pet.py index 766782eb6..b5255557f 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/pet.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/pet.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/salmon.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/salmon.py index f718fe7b9..1be7d3ea2 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/salmon.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/salmon.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/sawshark.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/sawshark.py index f45cb2bda..b2a3d68fe 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/sawshark.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/sawshark.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/shark.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/shark.py index 71333afb3..e74486352 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/shark.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/shark.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/siamese.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/siamese.py index c8c674767..9411922eb 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/siamese.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/siamese.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/string_wrapper.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/string_wrapper.py index a0b5a00c9..633b4dea8 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/string_wrapper.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/models/string_wrapper.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/__init__.py index 172eef00e..4b569da26 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/__init__.py @@ -4,25 +4,25 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from .basic_operations import basicOperations -from .primitive import primitive -from .array import array -from .dictionary import dictionary -from .inheritance import inheritance -from .polymorphism import polymorphism -from .polymorphicrecursive import polymorphicrecursive +from .basic_operations import BasicOperations +from .primitive import Primitive +from .array import Array +from .dictionary import Dictionary +from .inheritance import Inheritance +from .polymorphism import Polymorphism +from .polymorphicrecursive import Polymorphicrecursive __all__ = [ - 'basicOperations', - 'primitive', - 'array', - 'dictionary', - 'inheritance', - 'polymorphism', - 'polymorphicrecursive', + 'BasicOperations', + 'Primitive', + 'Array', + 'Dictionary', + 'Inheritance', + 'Polymorphism', + 'Polymorphicrecursive', ] diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/array.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/array.py index b1b36a17e..43224e1da 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/array.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/array.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class array(object): +class Array(object): def __init__(self, client, config, serializer, derserializer): @@ -29,22 +29,18 @@ class array(object): def get_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get complex types with array property - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: arraywrapper or (arraywrapper, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/array/valid' @@ -79,23 +75,19 @@ class array(object): def put_valid( self, array=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put complex types with array property :param array: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array: list or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array: list or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - complex_body = models.ArrayWrapper() if array is not None: complex_body.array = array @@ -131,22 +123,18 @@ class array(object): def get_empty( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get complex types with array property which is empty - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: arraywrapper or (arraywrapper, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/array/empty' @@ -181,23 +169,19 @@ class array(object): def put_empty( self, array=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put complex types with array property which is empty :param array: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array: list or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array: list or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - complex_body = models.ArrayWrapper() if array is not None: complex_body.array = array @@ -233,23 +217,19 @@ class array(object): def get_not_provided( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get complex types with array property while server doesn't provide a response payload - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: arraywrapper or (arraywrapper, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/array/notprovided' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/basic_operations.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/basic_operations.py index 90d0afe1f..454b67ffd 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/basic_operations.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/basic_operations.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class basicOperations(object): +class BasicOperations(object): def __init__(self, client, config, serializer, derserializer): @@ -29,22 +29,18 @@ class basicOperations(object): def get_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get complex type {id: 2, name: 'abc', color: 'YELLOW'} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: basic or (basic, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/basic/valid' @@ -79,23 +75,19 @@ class basicOperations(object): def put_valid( self, complex_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Please put {id: 2, name: 'abc', color: 'Magenta'} :param complex_body: Please put {id: 2, name: 'abc', color: 'Magenta'} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type complex_body: basic + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type complex_body: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/basic/valid' @@ -127,22 +119,18 @@ class basicOperations(object): def get_invalid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get a basic complex type that is invalid for the local strong type - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: basic or (basic, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/basic/invalid' @@ -177,22 +165,18 @@ class basicOperations(object): def get_empty( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get a basic complex type that is empty - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: basic or (basic, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/basic/empty' @@ -227,22 +211,18 @@ class basicOperations(object): def get_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get a basic complex type whose properties are null - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: basic or (basic, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/basic/null' @@ -277,23 +257,19 @@ class basicOperations(object): def get_not_provided( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get a basic complex type while the server doesn't provide a response payload - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: basic or (basic, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/basic/notprovided' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/dictionary.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/dictionary.py index f2ff8b3a5..d5f91755e 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/dictionary.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/dictionary.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class dictionary(object): +class Dictionary(object): def __init__(self, client, config, serializer, derserializer): @@ -29,22 +29,18 @@ class dictionary(object): def get_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get complex types with dictionary property - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: dictionarywrapper or (dictionarywrapper, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/dictionary/typed/valid' @@ -79,23 +75,19 @@ class dictionary(object): def put_valid( self, default_program=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put complex types with dictionary property :param default_program: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type default_program: dict or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type default_program: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - complex_body = models.DictionaryWrapper() if default_program is not None: complex_body.default_program = default_program @@ -131,22 +123,18 @@ class dictionary(object): def get_empty( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get complex types with dictionary property which is empty - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: dictionarywrapper or (dictionarywrapper, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/dictionary/typed/empty' @@ -181,23 +169,19 @@ class dictionary(object): def put_empty( self, default_program=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put complex types with dictionary property which is empty :param default_program: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type default_program: dict or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type default_program: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - complex_body = models.DictionaryWrapper() if default_program is not None: complex_body.default_program = default_program @@ -233,22 +217,18 @@ class dictionary(object): def get_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get complex types with dictionary property which is null - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: dictionarywrapper or (dictionarywrapper, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/dictionary/typed/null' @@ -283,23 +263,19 @@ class dictionary(object): def get_not_provided( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get complex types with dictionary property while server doesn't provide a response payload - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: dictionarywrapper or (dictionarywrapper, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/dictionary/typed/notprovided' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/inheritance.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/inheritance.py index 5518d27e5..2e06fc125 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/inheritance.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/inheritance.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class inheritance(object): +class Inheritance(object): def __init__(self, client, config, serializer, derserializer): @@ -29,22 +29,18 @@ class inheritance(object): def get_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get complex types that extend others - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: siamese or (siamese, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/inheritance/valid' @@ -79,26 +75,22 @@ class inheritance(object): def put_valid( self, complex_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put complex types that extend others :param complex_body: Please put a siamese with id=2, name="Siameee", color=green, breed=persion, which hates 2 dogs, the 1st one named "Potato" with id=1 and food="tomato", and the 2nd one named "Tomato" with id=-1 and food="french fries". - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type complex_body: siamese + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type complex_body: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/inheritance/valid' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/polymorphicrecursive.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/polymorphicrecursive.py index 7628b1792..ca31ebf81 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/polymorphicrecursive.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/polymorphicrecursive.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class polymorphicrecursive(object): +class Polymorphicrecursive(object): def __init__(self, client, config, serializer, derserializer): @@ -29,22 +29,17 @@ class polymorphicrecursive(object): def get_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get complex types that are polymorphic and have recursive references - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: fish or (fish, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/polymorphicrecursive/valid' @@ -79,7 +74,6 @@ class polymorphicrecursive(object): def put_valid( self, complex_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put complex types that are polymorphic and have recursive references :param complex_body: Please put a salmon that looks like this: @@ -135,19 +129,16 @@ class polymorphicrecursive(object): } ] } - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type complex_body: fish + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type complex_body: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/polymorphicrecursive/valid' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/polymorphism.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/polymorphism.py index 8e611bbb1..d297bf359 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/polymorphism.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/polymorphism.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class polymorphism(object): +class Polymorphism(object): def __init__(self, client, config, serializer, derserializer): @@ -29,22 +29,17 @@ class polymorphism(object): def get_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get complex types that are polymorphic - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: fish or (fish, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/polymorphism/valid' @@ -79,7 +74,6 @@ class polymorphism(object): def put_valid( self, complex_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put complex types that are polymorphic :param complex_body: Please put a salmon that looks like this: @@ -116,19 +110,16 @@ class polymorphism(object): } ] }; - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type complex_body: fish + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type complex_body: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/polymorphism/valid' @@ -160,7 +151,6 @@ class polymorphism(object): def put_valid_missing_required( self, complex_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put complex types that are polymorphic, attempting to omit required 'birthday' field - the request should not be allowed from the client @@ -191,19 +181,16 @@ class polymorphism(object): } ] } - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type complex_body: fish + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type complex_body: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/polymorphism/missingrequired/invalid' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/primitive.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/primitive.py index 3117de3bb..b13fb9e22 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/primitive.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/primitive.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class primitive(object): +class Primitive(object): def __init__(self, client, config, serializer, derserializer): @@ -29,22 +29,18 @@ class primitive(object): def get_int( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get complex types with integer properties - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: intwrapper or (intwrapper, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/primitive/integer' @@ -79,23 +75,19 @@ class primitive(object): def put_int( self, complex_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put complex types with integer properties :param complex_body: Please put -1 and 2 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type complex_body: intwrapper + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type complex_body: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/primitive/integer' @@ -127,22 +119,18 @@ class primitive(object): def get_long( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get complex types with long properties - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: longwrapper or (longwrapper, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/primitive/long' @@ -177,23 +165,19 @@ class primitive(object): def put_long( self, complex_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put complex types with long properties :param complex_body: Please put 1099511627775 and -999511627788 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type complex_body: longwrapper + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type complex_body: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/primitive/long' @@ -225,22 +209,18 @@ class primitive(object): def get_float( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get complex types with float properties - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: floatwrapper or (floatwrapper, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/primitive/float' @@ -275,23 +255,19 @@ class primitive(object): def put_float( self, complex_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put complex types with float properties :param complex_body: Please put 1.05 and -0.003 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type complex_body: floatwrapper + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type complex_body: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/primitive/float' @@ -323,22 +299,18 @@ class primitive(object): def get_double( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get complex types with double properties - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: doublewrapper or (doublewrapper, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/primitive/double' @@ -373,24 +345,20 @@ class primitive(object): def put_double( self, complex_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put complex types with double properties :param complex_body: Please put 3e-100 and -0.000000000000000000000000000000000000000000000000000000005 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type complex_body: doublewrapper + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type complex_body: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/primitive/double' @@ -422,22 +390,18 @@ class primitive(object): def get_bool( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get complex types with bool properties - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: booleanwrapper or (booleanwrapper, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/primitive/bool' @@ -472,23 +436,19 @@ class primitive(object): def put_bool( self, complex_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put complex types with bool properties :param complex_body: Please put true and false - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type complex_body: booleanwrapper + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type complex_body: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/primitive/bool' @@ -520,22 +480,18 @@ class primitive(object): def get_string( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get complex types with string properties - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: stringwrapper or (stringwrapper, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/primitive/string' @@ -570,23 +526,19 @@ class primitive(object): def put_string( self, complex_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put complex types with string properties :param complex_body: Please put 'goodrequest', '', and null - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type complex_body: stringwrapper + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type complex_body: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/primitive/string' @@ -618,22 +570,18 @@ class primitive(object): def get_date( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get complex types with date properties - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: datewrapper or (datewrapper, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/primitive/date' @@ -668,23 +616,19 @@ class primitive(object): def put_date( self, complex_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put complex types with date properties :param complex_body: Please put '0001-01-01' and '2016-02-29' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type complex_body: datewrapper + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type complex_body: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/primitive/date' @@ -716,22 +660,18 @@ class primitive(object): def get_date_time( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get complex types with datetime properties - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: datetimewrapper or (datetimewrapper, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/primitive/datetime' @@ -766,24 +706,20 @@ class primitive(object): def put_date_time( self, complex_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put complex types with datetime properties :param complex_body: Please put '0001-01-01T12:00:00-04:00' and '2015-05-18T11:38:00-08:00' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type complex_body: datetimewrapper + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type complex_body: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/primitive/datetime' @@ -815,22 +751,18 @@ class primitive(object): def get_date_time_rfc1123( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get complex types with datetimeRfc1123 properties - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: datetimerfc1123wrapper or (datetimerfc1123wrapper, + requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/primitive/datetimerfc1123' @@ -865,24 +797,20 @@ class primitive(object): def put_date_time_rfc1123( self, complex_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put complex types with datetimeRfc1123 properties :param complex_body: Please put 'Mon, 01 Jan 0001 12:00:00 GMT' and 'Mon, 18 May 2015 11:38:00 GMT' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type complex_body: datetimerfc1123wrapper + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type complex_body: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/primitive/datetimerfc1123' @@ -914,22 +842,18 @@ class primitive(object): def get_duration( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get complex types with duration properties - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: durationwrapper or (durationwrapper, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/primitive/duration' @@ -964,23 +888,19 @@ class primitive(object): def put_duration( self, field=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put complex types with duration properties :param field: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type field: timedelta or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type field: timedelta or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - complex_body = models.DurationWrapper() if field is not None: complex_body.field = field @@ -1016,22 +936,18 @@ class primitive(object): def get_byte( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get complex types with byte properties - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: bytewrapper or (bytewrapper, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/complex/primitive/byte' @@ -1066,23 +982,19 @@ class primitive(object): def put_byte( self, field=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put complex types with byte properties :param field: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type field: bytearray or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type field: bytearray or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - complex_body = models.ByteWrapper() if field is not None: complex_body.field = field diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/setup.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/setup.py index 11efda15a..25ad27a77 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/setup.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/setup.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -22,7 +22,7 @@ VERSION = "1.0.0" # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.10", "six >= 1.9", "certifi", "python-dateutil"] +REQUIRES = ["msrest>=0.0.1"] setup( name=NAME, diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/auto_rest_date_test_service/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/auto_rest_date_test_service/__init__.py index 11badf05e..b6d09b241 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/auto_rest_date_test_service/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/auto_rest_date_test_service/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/auto_rest_date_test_service/api_client.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/auto_rest_date_test_service/api_client.py index 624e8fff9..22684f526 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/auto_rest_date_test_service/api_client.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/auto_rest_date_test_service/api_client.py @@ -4,14 +4,14 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- from msrest.service_client import ServiceClient from msrest import Configuration, Serializer, Deserializer -from .operations.date_model import date_model +from .operations.date_model import DateModel from . import models @@ -39,5 +39,5 @@ class AutoRestDateTestService(object): self._deserialize = Deserializer(client_models) self.config = config - self.date_model = date_model( + self.date_model = DateModel( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/auto_rest_date_test_service/models/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/auto_rest_date_test_service/models/__init__.py index 1448b1ade..279ee4c88 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/auto_rest_date_test_service/models/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/auto_rest_date_test_service/models/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/auto_rest_date_test_service/models/error.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/auto_rest_date_test_service/models/error.py index 1413fe073..d6b15c22e 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/auto_rest_date_test_service/models/error.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/auto_rest_date_test_service/models/error.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/auto_rest_date_test_service/operations/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/auto_rest_date_test_service/operations/__init__.py index 6c41dd733..2b782b5ff 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/auto_rest_date_test_service/operations/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/auto_rest_date_test_service/operations/__init__.py @@ -4,13 +4,13 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from .date_model import date_model +from .date_model import DateModel __all__ = [ - 'date_model', + 'DateModel', ] diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/auto_rest_date_test_service/operations/date_model.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/auto_rest_date_test_service/operations/date_model.py index 7e9287b80..7e85da543 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/auto_rest_date_test_service/operations/date_model.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/auto_rest_date_test_service/operations/date_model.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class date_model(object): +class DateModel(object): def __init__(self, client, config, serializer, derserializer): @@ -29,21 +29,17 @@ class date_model(object): def get_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get null date value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: date or (date, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/date/null' @@ -78,21 +74,17 @@ class date_model(object): def get_invalid_date( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get invalid date value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: date or (date, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/date/invaliddate' @@ -127,21 +119,17 @@ class date_model(object): def get_overflow_date( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get overflow date value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: date or (date, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/date/overflowdate' @@ -176,21 +164,17 @@ class date_model(object): def get_underflow_date( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get underflow date value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: date or (date, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/date/underflowdate' @@ -225,23 +209,19 @@ class date_model(object): def put_max_date( self, date_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put max date value 9999-12-31 :param date_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type date_body: date + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type date_body: date - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/date/max' @@ -273,21 +253,17 @@ class date_model(object): def get_max_date( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get max date value 9999-12-31 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: date or (date, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/date/max' @@ -322,23 +298,19 @@ class date_model(object): def put_min_date( self, date_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put min date value 0000-01-01 :param date_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type date_body: date + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type date_body: date - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/date/min' @@ -370,21 +342,17 @@ class date_model(object): def get_min_date( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get min date value 0000-01-01 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: date or (date, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/date/min' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/setup.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/setup.py index 80a486c01..97367a821 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/setup.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/setup.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -22,7 +22,7 @@ VERSION = "1.0.0" # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.10", "six >= 1.9", "certifi", "python-dateutil"] +REQUIRES = ["msrest>=0.0.1"] setup( name=NAME, diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/auto_rest_date_time_test_service/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/auto_rest_date_time_test_service/__init__.py index 9448138c2..c2d4e4e79 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/auto_rest_date_time_test_service/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/auto_rest_date_time_test_service/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/auto_rest_date_time_test_service/api_client.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/auto_rest_date_time_test_service/api_client.py index 913a5c62f..029ee0724 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/auto_rest_date_time_test_service/api_client.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/auto_rest_date_time_test_service/api_client.py @@ -4,14 +4,14 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- from msrest.service_client import ServiceClient from msrest import Configuration, Serializer, Deserializer -from .operations.datetime_model import datetime_model +from .operations.datetime_model import DatetimeModel from . import models @@ -39,5 +39,5 @@ class AutoRestDateTimeTestService(object): self._deserialize = Deserializer(client_models) self.config = config - self.datetime_model = datetime_model( + self.datetime_model = DatetimeModel( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/auto_rest_date_time_test_service/models/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/auto_rest_date_time_test_service/models/__init__.py index 1448b1ade..279ee4c88 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/auto_rest_date_time_test_service/models/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/auto_rest_date_time_test_service/models/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/auto_rest_date_time_test_service/models/error.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/auto_rest_date_time_test_service/models/error.py index 1413fe073..d6b15c22e 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/auto_rest_date_time_test_service/models/error.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/auto_rest_date_time_test_service/models/error.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/auto_rest_date_time_test_service/operations/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/auto_rest_date_time_test_service/operations/__init__.py index 175b745b2..68b32c049 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/auto_rest_date_time_test_service/operations/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/auto_rest_date_time_test_service/operations/__init__.py @@ -4,13 +4,13 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from .datetime_model import datetime_model +from .datetime_model import DatetimeModel __all__ = [ - 'datetime_model', + 'DatetimeModel', ] diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/auto_rest_date_time_test_service/operations/datetime_model.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/auto_rest_date_time_test_service/operations/datetime_model.py index 980a7c9e5..df1f13dce 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/auto_rest_date_time_test_service/operations/datetime_model.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/auto_rest_date_time_test_service/operations/datetime_model.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class datetime_model(object): +class DatetimeModel(object): def __init__(self, client, config, serializer, derserializer): @@ -29,22 +29,18 @@ class datetime_model(object): def get_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get null datetime value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: datetime or (datetime, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/datetime/null' @@ -79,22 +75,18 @@ class datetime_model(object): def get_invalid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get invalid datetime value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: datetime or (datetime, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/datetime/invalid' @@ -129,22 +121,18 @@ class datetime_model(object): def get_overflow( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get overflow datetime value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: datetime or (datetime, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/datetime/overflow' @@ -179,22 +167,18 @@ class datetime_model(object): def get_underflow( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get underflow datetime value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: datetime or (datetime, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/datetime/underflow' @@ -229,23 +213,19 @@ class datetime_model(object): def put_utc_max_date_time( self, datetime_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put max datetime value 9999-12-31T23:59:59.9999999Z :param datetime_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type datetime_body: datetime + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type datetime_body: datetime - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/datetime/max/utc' @@ -277,22 +257,18 @@ class datetime_model(object): def get_utc_lowercase_max_date_time( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get max datetime value 9999-12-31t23:59:59.9999999z - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: datetime or (datetime, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/datetime/max/utc/lowercase' @@ -327,22 +303,18 @@ class datetime_model(object): def get_utc_uppercase_max_date_time( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get max datetime value 9999-12-31T23:59:59.9999999Z - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: datetime or (datetime, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/datetime/max/utc/uppercase' @@ -377,24 +349,20 @@ class datetime_model(object): def put_local_positive_offset_max_date_time( self, datetime_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put max datetime value with positive numoffset 9999-12-31t23:59:59.9999999+14:00 :param datetime_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type datetime_body: datetime + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type datetime_body: datetime - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/datetime/max/localpositiveoffset' @@ -426,23 +394,19 @@ class datetime_model(object): def get_local_positive_offset_lowercase_max_date_time( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get max datetime value with positive num offset 9999-12-31t23:59:59.9999999+14:00 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: datetime or (datetime, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/datetime/max/localpositiveoffset/lowercase' @@ -477,23 +441,19 @@ class datetime_model(object): def get_local_positive_offset_uppercase_max_date_time( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get max datetime value with positive num offset 9999-12-31T23:59:59.9999999+14:00 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: datetime or (datetime, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/datetime/max/localpositiveoffset/uppercase' @@ -528,24 +488,20 @@ class datetime_model(object): def put_local_negative_offset_max_date_time( self, datetime_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put max datetime value with positive numoffset 9999-12-31t23:59:59.9999999-14:00 :param datetime_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type datetime_body: datetime + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type datetime_body: datetime - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/datetime/max/localnegativeoffset' @@ -577,23 +533,19 @@ class datetime_model(object): def get_local_negative_offset_uppercase_max_date_time( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get max datetime value with positive num offset 9999-12-31T23:59:59.9999999-14:00 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: datetime or (datetime, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/datetime/max/localnegativeoffset/uppercase' @@ -628,23 +580,19 @@ class datetime_model(object): def get_local_negative_offset_lowercase_max_date_time( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get max datetime value with positive num offset 9999-12-31t23:59:59.9999999-14:00 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: datetime or (datetime, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/datetime/max/localnegativeoffset/lowercase' @@ -679,23 +627,19 @@ class datetime_model(object): def put_utc_min_date_time( self, datetime_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put min datetime value 0001-01-01T00:00:00Z :param datetime_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type datetime_body: datetime + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type datetime_body: datetime - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/datetime/min/utc' @@ -727,22 +671,18 @@ class datetime_model(object): def get_utc_min_date_time( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get min datetime value 0001-01-01T00:00:00Z - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: datetime or (datetime, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/datetime/min/utc' @@ -777,23 +717,19 @@ class datetime_model(object): def put_local_positive_offset_min_date_time( self, datetime_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put min datetime value 0001-01-01T00:00:00+14:00 :param datetime_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type datetime_body: datetime + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type datetime_body: datetime - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/datetime/min/localpositiveoffset' @@ -825,22 +761,18 @@ class datetime_model(object): def get_local_positive_offset_min_date_time( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get min datetime value 0001-01-01T00:00:00+14:00 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: datetime or (datetime, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/datetime/min/localpositiveoffset' @@ -875,23 +807,19 @@ class datetime_model(object): def put_local_negative_offset_min_date_time( self, datetime_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put min datetime value 0001-01-01T00:00:00-14:00 :param datetime_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type datetime_body: datetime + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type datetime_body: datetime - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/datetime/min/localnegativeoffset' @@ -923,22 +851,18 @@ class datetime_model(object): def get_local_negative_offset_min_date_time( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get min datetime value 0001-01-01T00:00:00-14:00 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: datetime or (datetime, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/datetime/min/localnegativeoffset' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/setup.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/setup.py index 281e3bbf2..93a6ec04f 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/setup.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/setup.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -22,7 +22,7 @@ VERSION = "1.0.0" # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.10", "six >= 1.9", "certifi", "python-dateutil"] +REQUIRES = ["msrest>=0.0.1"] setup( name=NAME, diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/auto_rest_rfc1123_date_time_test_service/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/auto_rest_rfc1123_date_time_test_service/__init__.py index bdbcc7c0e..0616dc4de 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/auto_rest_rfc1123_date_time_test_service/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/auto_rest_rfc1123_date_time_test_service/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/auto_rest_rfc1123_date_time_test_service/api_client.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/auto_rest_rfc1123_date_time_test_service/api_client.py index 7b173c091..f384d6daa 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/auto_rest_rfc1123_date_time_test_service/api_client.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/auto_rest_rfc1123_date_time_test_service/api_client.py @@ -4,14 +4,14 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- from msrest.service_client import ServiceClient from msrest import Configuration, Serializer, Deserializer -from .operations.datetimerfc1123 import datetimerfc1123 +from .operations.datetimerfc1123 import Datetimerfc1123 from . import models @@ -39,5 +39,5 @@ class AutoRestRFC1123DateTimeTestService(object): self._deserialize = Deserializer(client_models) self.config = config - self.datetimerfc1123 = datetimerfc1123( + self.datetimerfc1123 = Datetimerfc1123( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/auto_rest_rfc1123_date_time_test_service/models/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/auto_rest_rfc1123_date_time_test_service/models/__init__.py index 1448b1ade..279ee4c88 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/auto_rest_rfc1123_date_time_test_service/models/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/auto_rest_rfc1123_date_time_test_service/models/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/auto_rest_rfc1123_date_time_test_service/models/error.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/auto_rest_rfc1123_date_time_test_service/models/error.py index 1413fe073..d6b15c22e 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/auto_rest_rfc1123_date_time_test_service/models/error.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/auto_rest_rfc1123_date_time_test_service/models/error.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/auto_rest_rfc1123_date_time_test_service/operations/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/auto_rest_rfc1123_date_time_test_service/operations/__init__.py index 83ae88b3f..5bdde54fd 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/auto_rest_rfc1123_date_time_test_service/operations/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/auto_rest_rfc1123_date_time_test_service/operations/__init__.py @@ -4,13 +4,13 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from .datetimerfc1123 import datetimerfc1123 +from .datetimerfc1123 import Datetimerfc1123 __all__ = [ - 'datetimerfc1123', + 'Datetimerfc1123', ] diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/auto_rest_rfc1123_date_time_test_service/operations/datetimerfc1123.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/auto_rest_rfc1123_date_time_test_service/operations/datetimerfc1123.py index 2653c61e3..1c1c0e401 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/auto_rest_rfc1123_date_time_test_service/operations/datetimerfc1123.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/auto_rest_rfc1123_date_time_test_service/operations/datetimerfc1123.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class datetimerfc1123(object): +class Datetimerfc1123(object): def __init__(self, client, config, serializer, derserializer): @@ -29,22 +29,18 @@ class datetimerfc1123(object): def get_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get null datetime value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: datetime or (datetime, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/datetimerfc1123/null' @@ -79,22 +75,18 @@ class datetimerfc1123(object): def get_invalid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get invalid datetime value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: datetime or (datetime, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/datetimerfc1123/invalid' @@ -129,22 +121,18 @@ class datetimerfc1123(object): def get_overflow( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get overflow datetime value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: datetime or (datetime, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/datetimerfc1123/overflow' @@ -179,22 +167,18 @@ class datetimerfc1123(object): def get_underflow( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get underflow datetime value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: datetime or (datetime, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/datetimerfc1123/underflow' @@ -229,23 +213,19 @@ class datetimerfc1123(object): def put_utc_max_date_time( self, datetime_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put max datetime value Fri, 31 Dec 9999 23:59:59 GMT :param datetime_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type datetime_body: datetime + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type datetime_body: datetime - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/datetimerfc1123/max' @@ -277,22 +257,18 @@ class datetimerfc1123(object): def get_utc_lowercase_max_date_time( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get max datetime value fri, 31 dec 9999 23:59:59 gmt - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: datetime or (datetime, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/datetimerfc1123/max/lowercase' @@ -327,22 +303,18 @@ class datetimerfc1123(object): def get_utc_uppercase_max_date_time( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get max datetime value FRI, 31 DEC 9999 23:59:59 GMT - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: datetime or (datetime, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/datetimerfc1123/max/uppercase' @@ -377,23 +349,19 @@ class datetimerfc1123(object): def put_utc_min_date_time( self, datetime_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put min datetime value Mon, 1 Jan 0001 00:00:00 GMT :param datetime_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type datetime_body: datetime + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type datetime_body: datetime - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/datetimerfc1123/min' @@ -425,22 +393,18 @@ class datetimerfc1123(object): def get_utc_min_date_time( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get min datetime value Mon, 1 Jan 0001 00:00:00 GMT - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: datetime or (datetime, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/datetimerfc1123/min' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/setup.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/setup.py index a11eb1534..8a9ce5149 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/setup.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/setup.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -22,7 +22,7 @@ VERSION = "1.0.0" # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.10", "six >= 1.9", "certifi", "python-dateutil"] +REQUIRES = ["msrest>=0.0.1"] setup( name=NAME, diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/auto_rest_swagger_ba_tdictionary_service/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/auto_rest_swagger_ba_tdictionary_service/__init__.py index 941445f9a..5470a1ce3 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/auto_rest_swagger_ba_tdictionary_service/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/auto_rest_swagger_ba_tdictionary_service/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/auto_rest_swagger_ba_tdictionary_service/api_client.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/auto_rest_swagger_ba_tdictionary_service/api_client.py index 60d3c5c95..86d0e3abb 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/auto_rest_swagger_ba_tdictionary_service/api_client.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/auto_rest_swagger_ba_tdictionary_service/api_client.py @@ -4,14 +4,14 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- from msrest.service_client import ServiceClient from msrest import Configuration, Serializer, Deserializer -from .operations.dictionary import dictionary +from .operations.dictionary import Dictionary from . import models @@ -39,5 +39,5 @@ class AutoRestSwaggerBATdictionaryService(object): self._deserialize = Deserializer(client_models) self.config = config - self.dictionary = dictionary( + self.dictionary = Dictionary( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/auto_rest_swagger_ba_tdictionary_service/models/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/auto_rest_swagger_ba_tdictionary_service/models/__init__.py index db9934eaf..90cded3c1 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/auto_rest_swagger_ba_tdictionary_service/models/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/auto_rest_swagger_ba_tdictionary_service/models/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/auto_rest_swagger_ba_tdictionary_service/models/error.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/auto_rest_swagger_ba_tdictionary_service/models/error.py index 1413fe073..d6b15c22e 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/auto_rest_swagger_ba_tdictionary_service/models/error.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/auto_rest_swagger_ba_tdictionary_service/models/error.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/auto_rest_swagger_ba_tdictionary_service/models/widget.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/auto_rest_swagger_ba_tdictionary_service/models/widget.py index e78dff047..2f1e2acf5 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/auto_rest_swagger_ba_tdictionary_service/models/widget.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/auto_rest_swagger_ba_tdictionary_service/models/widget.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/auto_rest_swagger_ba_tdictionary_service/operations/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/auto_rest_swagger_ba_tdictionary_service/operations/__init__.py index ba6a57e33..e6dcb563b 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/auto_rest_swagger_ba_tdictionary_service/operations/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/auto_rest_swagger_ba_tdictionary_service/operations/__init__.py @@ -4,13 +4,13 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from .dictionary import dictionary +from .dictionary import Dictionary __all__ = [ - 'dictionary', + 'Dictionary', ] diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/auto_rest_swagger_ba_tdictionary_service/operations/dictionary.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/auto_rest_swagger_ba_tdictionary_service/operations/dictionary.py index d3df5a2b9..19f1b8d67 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/auto_rest_swagger_ba_tdictionary_service/operations/dictionary.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/auto_rest_swagger_ba_tdictionary_service/operations/dictionary.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class dictionary(object): +class Dictionary(object): def __init__(self, client, config, serializer, derserializer): @@ -29,22 +29,17 @@ class dictionary(object): def get_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get null dictionary value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/null' @@ -79,22 +74,17 @@ class dictionary(object): def get_empty( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get empty dictionary value {} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/empty' @@ -129,23 +119,19 @@ class dictionary(object): def put_empty( self, array_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Set dictionary value empty {} :param array_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_body: dict + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_body: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/empty' @@ -177,22 +163,17 @@ class dictionary(object): def get_null_value( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get Dictionary with null value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/nullvalue' @@ -227,22 +208,17 @@ class dictionary(object): def get_null_key( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get Dictionary with null key - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/nullkey' @@ -277,22 +253,17 @@ class dictionary(object): def get_empty_string_key( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get Dictionary with key as empty string - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/keyemptystring' @@ -327,22 +298,17 @@ class dictionary(object): def get_invalid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get invalid Dictionary value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/invalid' @@ -377,23 +343,18 @@ class dictionary(object): def get_boolean_tfft( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get boolean dictionary value {"0": true, "1": false, "2": false, "3": true } - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/boolean/tfft' @@ -428,24 +389,20 @@ class dictionary(object): def put_boolean_tfft( self, array_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Set dictionary value empty {"0": true, "1": false, "2": false, "3": true } :param array_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_body: dict + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_body: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/boolean/tfft' @@ -477,22 +434,17 @@ class dictionary(object): def get_boolean_invalid_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get boolean dictionary value {"0": true, "1": null, "2": false } - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/boolean/true.null.false' @@ -527,22 +479,17 @@ class dictionary(object): def get_boolean_invalid_string( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get boolean dictionary value '{"0": true, "1": "boolean", "2": false}' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/boolean/true.boolean.false' @@ -577,22 +524,17 @@ class dictionary(object): def get_integer_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get integer dictionary value {"0": 1, "1": -1, "2": 3, "3": 300} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/integer/1.-1.3.300' @@ -627,23 +569,19 @@ class dictionary(object): def put_integer_valid( self, array_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Set dictionary value empty {"0": 1, "1": -1, "2": 3, "3": 300} :param array_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_body: dict + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_body: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/integer/1.-1.3.300' @@ -675,22 +613,17 @@ class dictionary(object): def get_int_invalid_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get integer dictionary value {"0": 1, "1": null, "2": 0} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/integer/1.null.zero' @@ -725,22 +658,17 @@ class dictionary(object): def get_int_invalid_string( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get integer dictionary value {"0": 1, "1": "integer", "2": 0} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/integer/1.integer.0' @@ -775,22 +703,17 @@ class dictionary(object): def get_long_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get integer dictionary value {"0": 1, "1": -1, "2": 3, "3": 300} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/long/1.-1.3.300' @@ -825,23 +748,19 @@ class dictionary(object): def put_long_valid( self, array_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Set dictionary value empty {"0": 1, "1": -1, "2": 3, "3": 300} :param array_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_body: dict + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_body: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/long/1.-1.3.300' @@ -873,22 +792,17 @@ class dictionary(object): def get_long_invalid_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get long dictionary value {"0": 1, "1": null, "2": 0} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/long/1.null.zero' @@ -923,22 +837,17 @@ class dictionary(object): def get_long_invalid_string( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get long dictionary value {"0": 1, "1": "integer", "2": 0} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/long/1.integer.0' @@ -973,22 +882,17 @@ class dictionary(object): def get_float_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get float dictionary value {"0": 0, "1": -0.01, "2": 1.2e20} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/float/0--0.01-1.2e20' @@ -1023,23 +927,19 @@ class dictionary(object): def put_float_valid( self, array_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Set dictionary value {"0": 0, "1": -0.01, "2": 1.2e20} :param array_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_body: dict + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_body: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/float/0--0.01-1.2e20' @@ -1071,22 +971,17 @@ class dictionary(object): def get_float_invalid_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get float dictionary value {"0": 0.0, "1": null, "2": 1.2e20} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/float/0.0-null-1.2e20' @@ -1121,22 +1016,17 @@ class dictionary(object): def get_float_invalid_string( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get boolean dictionary value {"0": 1.0, "1": "number", "2": 0.0} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/float/1.number.0' @@ -1171,22 +1061,17 @@ class dictionary(object): def get_double_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get float dictionary value {"0": 0, "1": -0.01, "2": 1.2e20} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/double/0--0.01-1.2e20' @@ -1221,23 +1106,19 @@ class dictionary(object): def put_double_valid( self, array_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Set dictionary value {"0": 0, "1": -0.01, "2": 1.2e20} :param array_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_body: dict + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_body: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/double/0--0.01-1.2e20' @@ -1269,22 +1150,17 @@ class dictionary(object): def get_double_invalid_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get float dictionary value {"0": 0.0, "1": null, "2": 1.2e20} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/double/0.0-null-1.2e20' @@ -1319,22 +1195,17 @@ class dictionary(object): def get_double_invalid_string( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get boolean dictionary value {"0": 1.0, "1": "number", "2": 0.0} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/double/1.number.0' @@ -1369,22 +1240,17 @@ class dictionary(object): def get_string_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get string dictionary value {"0": "foo1", "1": "foo2", "2": "foo3"} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/string/foo1.foo2.foo3' @@ -1419,23 +1285,19 @@ class dictionary(object): def put_string_valid( self, array_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Set dictionary value {"0": "foo1", "1": "foo2", "2": "foo3"} :param array_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_body: dict + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_body: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/string/foo1.foo2.foo3' @@ -1467,22 +1329,17 @@ class dictionary(object): def get_string_with_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get string dictionary value {"0": "foo", "1": null, "2": "foo2"} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/string/foo.null.foo2' @@ -1517,22 +1374,17 @@ class dictionary(object): def get_string_with_invalid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get string dictionary value {"0": "foo", "1": 123, "2": "foo2"} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/string/foo.123.foo2' @@ -1567,23 +1419,18 @@ class dictionary(object): def get_date_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get integer dictionary value {"0": "2000-12-01", "1": "1980-01-02", "2": "1492-10-12"} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/date/valid' @@ -1618,24 +1465,20 @@ class dictionary(object): def put_date_valid( self, array_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Set dictionary value {"0": "2000-12-01", "1": "1980-01-02", "2": "1492-10-12"} :param array_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_body: dict + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_body: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/date/valid' @@ -1667,23 +1510,18 @@ class dictionary(object): def get_date_invalid_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get date dictionary value {"0": "2012-01-01", "1": null, "2": "1776-07-04"} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/date/invalidnull' @@ -1718,22 +1556,17 @@ class dictionary(object): def get_date_invalid_chars( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get date dictionary value {"0": "2011-03-22", "1": "date"} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/date/invalidchars' @@ -1768,23 +1601,18 @@ class dictionary(object): def get_date_time_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get date-time dictionary value {"0": "2000-12-01t00:00:01z", "1": "1980-01-02T00:11:35+01:00", "2": "1492-10-12T10:15:01-08:00"} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/date-time/valid' @@ -1819,24 +1647,20 @@ class dictionary(object): def put_date_time_valid( self, array_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Set dictionary value {"0": "2000-12-01t00:00:01z", "1": "1980-01-02T00:11:35+01:00", "2": "1492-10-12T10:15:01-08:00"} :param array_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_body: dict + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_body: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/date-time/valid' @@ -1868,22 +1692,17 @@ class dictionary(object): def get_date_time_invalid_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get date dictionary value {"0": "2000-12-01t00:00:01z", "1": null} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/date-time/invalidnull' @@ -1918,23 +1737,18 @@ class dictionary(object): def get_date_time_invalid_chars( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get date dictionary value {"0": "2000-12-01t00:00:01z", "1": "date-time"} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/date-time/invalidchars' @@ -1969,24 +1783,19 @@ class dictionary(object): def get_date_time_rfc1123_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get date-time-rfc1123 dictionary value {"0": "Fri, 01 Dec 2000 00:00:01 GMT", "1": "Wed, 02 Jan 1980 00:11:35 GMT", "2": "Wed, 12 Oct 1492 10:15:01 GMT"} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/date-time-rfc1123/valid' @@ -2021,24 +1830,20 @@ class dictionary(object): def put_date_time_rfc1123_valid( self, array_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Set dictionary value empty {"0": "Fri, 01 Dec 2000 00:00:01 GMT", "1": "Wed, 02 Jan 1980 00:11:35 GMT", "2": "Wed, 12 Oct 1492 10:15:01 GMT"} :param array_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_body: dict + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_body: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/date-time-rfc1123/valid' @@ -2070,23 +1875,18 @@ class dictionary(object): def get_duration_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get duration dictionary value {"0": "P123DT22H14M12.011S", "1": "P5DT1H0M0S"} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/duration/valid' @@ -2121,23 +1921,19 @@ class dictionary(object): def put_duration_valid( self, array_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Set dictionary value {"0": "P123DT22H14M12.011S", "1": "P5DT1H0M0S"} :param array_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_body: dict + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_body: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/duration/valid' @@ -2169,23 +1965,18 @@ class dictionary(object): def get_byte_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get byte dictionary value {"0": hex(FF FF FF FA), "1": hex(01 02 03), "2": hex (25, 29, 43)} with each item encoded in base64 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/byte/valid' @@ -2220,24 +2011,20 @@ class dictionary(object): def put_byte_valid( self, array_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put the dictionary value {"0": hex(FF FF FF FA), "1": hex(01 02 03), "2": hex (25, 29, 43)} with each elementencoded in base 64 :param array_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_body: dict + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_body: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/byte/valid' @@ -2269,23 +2056,18 @@ class dictionary(object): def get_byte_invalid_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get byte dictionary value {"0": hex(FF FF FF FA), "1": null} with the first item base64 encoded - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/prim/byte/invalidnull' @@ -2320,22 +2102,17 @@ class dictionary(object): def get_complex_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get dictionary of complex type null value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/complex/null' @@ -2370,22 +2147,17 @@ class dictionary(object): def get_complex_empty( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get empty dictionary of complex type {} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/complex/empty' @@ -2420,23 +2192,18 @@ class dictionary(object): def get_complex_item_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get dictionary of complex type with null item {"0": {"integer": 1, "string": "2"}, "1": null, "2": {"integer": 5, "string": "6"}} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/complex/itemnull' @@ -2471,23 +2238,18 @@ class dictionary(object): def get_complex_item_empty( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get dictionary of complex type with empty item {"0": {"integer": 1, "string": "2"}, "1:" {}, "2": {"integer": 5, "string": "6"}} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/complex/itemempty' @@ -2522,24 +2284,19 @@ class dictionary(object): def get_complex_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get dictionary of complex type with {"0": {"integer": 1, "string": "2"}, "1": {"integer": 3, "string": "4"}, "2": {"integer": 5, "string": "6"}} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/complex/valid' @@ -2574,25 +2331,21 @@ class dictionary(object): def put_complex_valid( self, array_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put an dictionary of complex type with values {"0": {"integer": 1, "string": "2"}, "1": {"integer": 3, "string": "4"}, "2": {"integer": 5, "string": "6"}} :param array_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_body: dict + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_body: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/complex/valid' @@ -2624,22 +2377,17 @@ class dictionary(object): def get_array_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get a null array - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/array/null' @@ -2674,22 +2422,17 @@ class dictionary(object): def get_array_empty( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get an empty dictionary {} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/array/empty' @@ -2724,23 +2467,18 @@ class dictionary(object): def get_array_item_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get an dictionary of array of strings {"0": ["1", "2", "3"], "1": null, "2": ["7", "8", "9"]} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/array/itemnull' @@ -2775,23 +2513,18 @@ class dictionary(object): def get_array_item_empty( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get an array of array of strings [{"0": ["1", "2", "3"], "1": [], "2": ["7", "8", "9"]} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/array/itemempty' @@ -2826,23 +2559,18 @@ class dictionary(object): def get_array_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get an array of array of strings {"0": ["1", "2", "3"], "1": ["4", "5", "6"], "2": ["7", "8", "9"]} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/array/valid' @@ -2877,24 +2605,20 @@ class dictionary(object): def put_array_valid( self, array_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put An array of array of strings {"0": ["1", "2", "3"], "1": ["4", "5", "6"], "2": ["7", "8", "9"]} :param array_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_body: dict + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_body: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/array/valid' @@ -2926,22 +2650,17 @@ class dictionary(object): def get_dictionary_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get an dictionaries of dictionaries with value null - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/dictionary/null' @@ -2976,23 +2695,18 @@ class dictionary(object): def get_dictionary_empty( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get an dictionaries of dictionaries of type with value {} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/dictionary/empty' @@ -3027,24 +2741,19 @@ class dictionary(object): def get_dictionary_item_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": null, "2": {"7": "seven", "8": "eight", "9": "nine"}} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/dictionary/itemnull' @@ -3079,24 +2788,19 @@ class dictionary(object): def get_dictionary_item_empty( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": {}, "2": {"7": "seven", "8": "eight", "9": "nine"}} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/dictionary/itemempty' @@ -3131,25 +2835,20 @@ class dictionary(object): def get_dictionary_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": {"4": "four", "5": "five", "6": "six"}, "2": {"7": "seven", "8": "eight", "9": "nine"}} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/dictionary/valid' @@ -3184,26 +2883,22 @@ class dictionary(object): def put_dictionary_valid( self, array_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": {"4": "four", "5": "five", "6": "six"}, "2": {"7": "seven", "8": "eight", "9": "nine"}} :param array_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_body: dict + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_body: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/dictionary/dictionary/valid' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/setup.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/setup.py index d6652b2f1..cbbc6efce 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/setup.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/setup.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -22,7 +22,7 @@ VERSION = "1.0.0" # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.10", "six >= 1.9", "certifi", "python-dateutil"] +REQUIRES = ["msrest>=0.0.1"] setup( name=NAME, diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/auto_rest_duration_test_service/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/auto_rest_duration_test_service/__init__.py index c2b33c38b..815affb2c 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/auto_rest_duration_test_service/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/auto_rest_duration_test_service/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/auto_rest_duration_test_service/api_client.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/auto_rest_duration_test_service/api_client.py index 2efcd39c4..3a51460f1 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/auto_rest_duration_test_service/api_client.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/auto_rest_duration_test_service/api_client.py @@ -4,14 +4,14 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- from msrest.service_client import ServiceClient from msrest import Configuration, Serializer, Deserializer -from .operations.duration import duration +from .operations.duration import Duration from . import models @@ -39,5 +39,5 @@ class AutoRestDurationTestService(object): self._deserialize = Deserializer(client_models) self.config = config - self.duration = duration( + self.duration = Duration( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/auto_rest_duration_test_service/models/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/auto_rest_duration_test_service/models/__init__.py index 1448b1ade..279ee4c88 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/auto_rest_duration_test_service/models/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/auto_rest_duration_test_service/models/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/auto_rest_duration_test_service/models/error.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/auto_rest_duration_test_service/models/error.py index 1413fe073..d6b15c22e 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/auto_rest_duration_test_service/models/error.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/auto_rest_duration_test_service/models/error.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/auto_rest_duration_test_service/operations/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/auto_rest_duration_test_service/operations/__init__.py index d67211d61..0cda029ee 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/auto_rest_duration_test_service/operations/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/auto_rest_duration_test_service/operations/__init__.py @@ -4,13 +4,13 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from .duration import duration +from .duration import Duration __all__ = [ - 'duration', + 'Duration', ] diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/auto_rest_duration_test_service/operations/duration.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/auto_rest_duration_test_service/operations/duration.py index 871a4bb45..00e483d14 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/auto_rest_duration_test_service/operations/duration.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/auto_rest_duration_test_service/operations/duration.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class duration(object): +class Duration(object): def __init__(self, client, config, serializer, derserializer): @@ -29,22 +29,18 @@ class duration(object): def get_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get null duration value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: timedelta or (timedelta, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/duration/null' @@ -79,23 +75,19 @@ class duration(object): def put_positive_duration( self, duration_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put a positive duration value :param duration_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type duration_body: timedelta + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type duration_body: timedelta - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/duration/positiveduration' @@ -127,22 +119,18 @@ class duration(object): def get_positive_duration( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get a positive duration value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: timedelta or (timedelta, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/duration/positiveduration' @@ -177,22 +165,18 @@ class duration(object): def get_invalid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get an invalid duration value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: timedelta or (timedelta, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/duration/invalid' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/setup.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/setup.py index 0065f162b..d28bc9fd0 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/setup.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/setup.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -22,7 +22,7 @@ VERSION = "1.0.0" # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.10", "six >= 1.9", "certifi", "python-dateutil"] +REQUIRES = ["msrest>=0.0.1"] setup( name=NAME, diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/auto_rest_swagger_bat_file_service/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/auto_rest_swagger_bat_file_service/__init__.py index e961137a6..35e2f9b5a 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/auto_rest_swagger_bat_file_service/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/auto_rest_swagger_bat_file_service/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/auto_rest_swagger_bat_file_service/api_client.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/auto_rest_swagger_bat_file_service/api_client.py index 9a596bb8d..09004fceb 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/auto_rest_swagger_bat_file_service/api_client.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/auto_rest_swagger_bat_file_service/api_client.py @@ -4,14 +4,14 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- from msrest.service_client import ServiceClient from msrest import Configuration, Serializer, Deserializer -from .operations.files import files +from .operations.files import Files from . import models @@ -39,5 +39,5 @@ class AutoRestSwaggerBATFileService(object): self._deserialize = Deserializer(client_models) self.config = config - self.files = files( + self.files = Files( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/auto_rest_swagger_bat_file_service/models/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/auto_rest_swagger_bat_file_service/models/__init__.py index 1448b1ade..279ee4c88 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/auto_rest_swagger_bat_file_service/models/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/auto_rest_swagger_bat_file_service/models/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/auto_rest_swagger_bat_file_service/models/error.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/auto_rest_swagger_bat_file_service/models/error.py index 1413fe073..d6b15c22e 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/auto_rest_swagger_bat_file_service/models/error.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/auto_rest_swagger_bat_file_service/models/error.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/auto_rest_swagger_bat_file_service/operations/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/auto_rest_swagger_bat_file_service/operations/__init__.py index d532d6dbd..a32325e96 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/auto_rest_swagger_bat_file_service/operations/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/auto_rest_swagger_bat_file_service/operations/__init__.py @@ -4,13 +4,13 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from .files import files +from .files import Files __all__ = [ - 'files', + 'Files', ] diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/auto_rest_swagger_bat_file_service/operations/files.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/auto_rest_swagger_bat_file_service/operations/files.py index c80d67c6d..36fff6f2f 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/auto_rest_swagger_bat_file_service/operations/files.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/auto_rest_swagger_bat_file_service/operations/files.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class files(object): +class Files(object): def __init__(self, client, config, serializer, derserializer): @@ -29,22 +29,18 @@ class files(object): def get_file( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get file - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: object or (object, requests.response) or concurrent.futures.Future """ - def download_gen(): for data in response.iter_content(self.config.connection.data_block_size): if not data: @@ -85,22 +81,18 @@ class files(object): def get_empty_file( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get empty file - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: object or (object, requests.response) or concurrent.futures.Future """ - def download_gen(): for data in response.iter_content(self.config.connection.data_block_size): if not data: diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/setup.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/setup.py index befe638d9..265378829 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/setup.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/setup.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -22,7 +22,7 @@ VERSION = "1.0.0" # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.10", "six >= 1.9", "certifi", "python-dateutil"] +REQUIRES = ["msrest>=0.0.1"] setup( name=NAME, diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/auto_rest_swagger_bat_form_data_service/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/auto_rest_swagger_bat_form_data_service/__init__.py new file mode 100644 index 000000000..4c21c1b3d --- /dev/null +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/auto_rest_swagger_bat_form_data_service/__init__.py @@ -0,0 +1,34 @@ +# 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 0.14.0.0 +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.exceptions import ( + ClientException, + SerializationError, + DeserializationError, + TokenExpiredError, + ClientRequestError, + AuthenticationError, + HttpOperationError, +) + +from .api_client import AutoRestSwaggerBATFormDataService, AutoRestSwaggerBATFormDataServiceConfiguration + +__all__ = [ + 'ClientException', + 'SerializationError', + 'DeserializationError', + 'TokenExpiredError', + 'ClientRequestError', + 'AuthenticationError', + 'HttpOperationError', + 'AutoRestSwaggerBATFormDataService', + 'AutoRestSwaggerBATFormDataServiceConfiguration' +] diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/auto_rest_swagger_bat_form_data_service/api_client.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/auto_rest_swagger_bat_form_data_service/api_client.py new file mode 100644 index 000000000..655bcda9a --- /dev/null +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/auto_rest_swagger_bat_form_data_service/api_client.py @@ -0,0 +1,43 @@ +# 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 0.14.0.0 +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.service_client import ServiceClient +from msrest import Configuration, Serializer, Deserializer +from .operations.formdata import Formdata +from . import models + + +class AutoRestSwaggerBATFormDataServiceConfiguration(Configuration): + + def __init__( + self, base_url=None, filepath=None): + + if not base_url: + base_url = 'http://localhost' + + super(AutoRestSwaggerBATFormDataServiceConfiguration, self).__init__(base_url, filepath) + + self.user_agent = 'auto_rest_swagger_bat_form_data_service/1.0.0' + + +class AutoRestSwaggerBATFormDataService(object): + + def __init__(self, config): + + self._client = ServiceClient(None, config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer() + self._deserialize = Deserializer(client_models) + + self.config = config + self.formdata = Formdata( + self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/auto_rest_swagger_bat_form_data_service/models/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/auto_rest_swagger_bat_form_data_service/models/__init__.py new file mode 100644 index 000000000..279ee4c88 --- /dev/null +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/auto_rest_swagger_bat_form_data_service/models/__init__.py @@ -0,0 +1,16 @@ +# 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 0.14.0.0 +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .error import Error, ErrorException + +__all__ = [ + 'Error', 'ErrorException', +] diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/auto_rest_swagger_bat_form_data_service/models/error.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/auto_rest_swagger_bat_form_data_service/models/error.py new file mode 100644 index 000000000..d6b15c22e --- /dev/null +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/auto_rest_swagger_bat_form_data_service/models/error.py @@ -0,0 +1,37 @@ +# 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 0.14.0.0 +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class Error(Model): + + _required = [] + + _attribute_map = { + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *args, **kwargs): + + self.status = None + self.message = None + + super(Error, self).__init__(*args, **kwargs) + + +class ErrorException(HttpOperationError): + + def __init__(self, deserialize, response, *args): + + super(ErrorException, self).__init__(deserialize, response, 'Error', *args) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/auto_rest_swagger_bat_form_data_service/operations/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/auto_rest_swagger_bat_form_data_service/operations/__init__.py new file mode 100644 index 000000000..3f85fea9f --- /dev/null +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/auto_rest_swagger_bat_form_data_service/operations/__init__.py @@ -0,0 +1,16 @@ +# 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 0.14.0.0 +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .formdata import Formdata + +__all__ = [ + 'Formdata', +] diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/auto_rest_swagger_bat_form_data_service/operations/formdata.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/auto_rest_swagger_bat_form_data_service/operations/formdata.py new file mode 100644 index 000000000..f8abc7556 --- /dev/null +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/auto_rest_swagger_bat_form_data_service/operations/formdata.py @@ -0,0 +1,144 @@ +# 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 0.14.0.0 +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.service_client import async_request +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class Formdata(object): + + def __init__(self, client, config, serializer, derserializer): + + self._client = client + self._serialize = serializer + self._deserialize = derserializer + + self.config = config + + @async_request + def upload_file( + self, file_content, file_name, custom_headers={}, raw=False, callback=None, **operation_config): + """ + Upload file + + :param file_content: File to upload. + :type file_content: object + :param file_name: File name to upload. Name has to be spelled exactly + as written here. + :type file_name: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response + :param callback: if provided, the call will run asynchronously and + call the callback when complete. When specified the function returns + a concurrent.futures.Future + :type callback: Callable[[concurrent.futures.Future], None] or None + :rtype: object or (object, requests.response) or + concurrent.futures.Future + """ + def download_gen(): + for data in response.iter_content(self.config.connection.data_block_size): + if not data: + break + yield data + + # Construct URL + url = '/formdata/stream/uploadfile' + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'multipart/form-data' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = download_gen() + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + @async_request + def upload_file_via_body( + self, file_content, file_name, custom_headers={}, raw=False, callback=None, **operation_config): + """ + Upload file + + :param file_content: File to upload. + :type file_content: object + :param file_name: File name to upload. Name has to be spelled exactly + as written here. + :type file_name: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response + :param callback: if provided, the call will run asynchronously and + call the callback when complete. When specified the function returns + a concurrent.futures.Future + :type callback: Callable[[concurrent.futures.Future], None] or None + :rtype: object or (object, requests.response) or + concurrent.futures.Future + """ + def download_gen(): + for data in response.iter_content(self.config.connection.data_block_size): + if not data: + break + yield data + + # Construct URL + url = '/formdata/stream/uploadfile' + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/octet-stream' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._serialize.body(file_content, 'Object') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = download_gen() + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/setup.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/setup.py new file mode 100644 index 000000000..5ef61386d --- /dev/null +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/setup.py @@ -0,0 +1,40 @@ +# 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 0.14.0.0 +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# coding: utf-8 + +from setuptools import setup, find_packages + +NAME = "auto_rest_swagger_bat_form_data_service" +VERSION = "1.0.0" + +# To install the library, run the following +# +# python setup.py install +# +# prerequisite: setuptools +# http://pypi.python.org/pypi/setuptools + +REQUIRES = ["msrest>=0.0.1"] + +setup( + name=NAME, + version=VERSION, + description="AutoRestSwaggerBATFormDataService", + author_email="", + url="", + keywords=["Swagger", "AutoRestSwaggerBATFormDataService"], + install_requires=REQUIRES, + packages=find_packages(), + include_package_data=True, + long_description="""\ + Test Infrastructure for AutoRest Swagger BAT + """ +) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/auto_rest_integer_test_service/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/auto_rest_integer_test_service/__init__.py index 8cad1f884..c4467bbb6 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/auto_rest_integer_test_service/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/auto_rest_integer_test_service/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/auto_rest_integer_test_service/api_client.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/auto_rest_integer_test_service/api_client.py index 19ecc913a..f2f33a7ad 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/auto_rest_integer_test_service/api_client.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/auto_rest_integer_test_service/api_client.py @@ -4,14 +4,14 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- from msrest.service_client import ServiceClient from msrest import Configuration, Serializer, Deserializer -from .operations.int_model import int_model +from .operations.int_model import IntModel from . import models @@ -39,5 +39,5 @@ class AutoRestIntegerTestService(object): self._deserialize = Deserializer(client_models) self.config = config - self.int_model = int_model( + self.int_model = IntModel( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/auto_rest_integer_test_service/models/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/auto_rest_integer_test_service/models/__init__.py index 1448b1ade..279ee4c88 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/auto_rest_integer_test_service/models/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/auto_rest_integer_test_service/models/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/auto_rest_integer_test_service/models/error.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/auto_rest_integer_test_service/models/error.py index 1413fe073..d6b15c22e 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/auto_rest_integer_test_service/models/error.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/auto_rest_integer_test_service/models/error.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/auto_rest_integer_test_service/operations/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/auto_rest_integer_test_service/operations/__init__.py index d4c8d30e9..9d2b6a7f6 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/auto_rest_integer_test_service/operations/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/auto_rest_integer_test_service/operations/__init__.py @@ -4,13 +4,13 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from .int_model import int_model +from .int_model import IntModel __all__ = [ - 'int_model', + 'IntModel', ] diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/auto_rest_integer_test_service/operations/int_model.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/auto_rest_integer_test_service/operations/int_model.py index 7b364b254..b23469da6 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/auto_rest_integer_test_service/operations/int_model.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/auto_rest_integer_test_service/operations/int_model.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class int_model(object): +class IntModel(object): def __init__(self, client, config, serializer, derserializer): @@ -29,21 +29,17 @@ class int_model(object): def get_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get null Int value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: int or (int, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/int/null' @@ -78,21 +74,17 @@ class int_model(object): def get_invalid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get invalid Int value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: int or (int, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/int/invalid' @@ -127,21 +119,17 @@ class int_model(object): def get_overflow_int32( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get overflow Int32 value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: int or (int, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/int/overflowint32' @@ -176,21 +164,17 @@ class int_model(object): def get_underflow_int32( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get underflow Int32 value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: int or (int, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/int/underflowint32' @@ -225,21 +209,17 @@ class int_model(object): def get_overflow_int64( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get overflow Int64 value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: long or (long, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/int/overflowint64' @@ -274,21 +254,17 @@ class int_model(object): def get_underflow_int64( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get underflow Int64 value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: long or (long, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/int/underflowint64' @@ -323,23 +299,19 @@ class int_model(object): def put_max32( self, int_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put max int32 value :param int_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type int_body: int + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type int_body: int - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/int/max/32' @@ -371,23 +343,19 @@ class int_model(object): def put_max64( self, int_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put max int64 value :param int_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type int_body: long + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type int_body: long - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/int/max/64' @@ -419,23 +387,19 @@ class int_model(object): def put_min32( self, int_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put min int32 value :param int_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type int_body: int + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type int_body: int - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/int/min/32' @@ -467,23 +431,19 @@ class int_model(object): def put_min64( self, int_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put min int64 value :param int_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type int_body: long + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type int_body: long - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/int/min/64' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/setup.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/setup.py index b1649154e..3b12e84a3 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/setup.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/setup.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -22,7 +22,7 @@ VERSION = "1.0.0" # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.10", "six >= 1.9", "certifi", "python-dateutil"] +REQUIRES = ["msrest>=0.0.1"] setup( name=NAME, diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/auto_rest_number_test_service/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/auto_rest_number_test_service/__init__.py index 9da210e9d..b7ff7c905 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/auto_rest_number_test_service/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/auto_rest_number_test_service/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/auto_rest_number_test_service/api_client.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/auto_rest_number_test_service/api_client.py index 77cafb54a..38c7b269b 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/auto_rest_number_test_service/api_client.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/auto_rest_number_test_service/api_client.py @@ -4,14 +4,14 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- from msrest.service_client import ServiceClient from msrest import Configuration, Serializer, Deserializer -from .operations.number import number +from .operations.number import Number from . import models @@ -39,5 +39,5 @@ class AutoRestNumberTestService(object): self._deserialize = Deserializer(client_models) self.config = config - self.number = number( + self.number = Number( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/auto_rest_number_test_service/models/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/auto_rest_number_test_service/models/__init__.py index 1448b1ade..279ee4c88 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/auto_rest_number_test_service/models/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/auto_rest_number_test_service/models/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/auto_rest_number_test_service/models/error.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/auto_rest_number_test_service/models/error.py index 1413fe073..d6b15c22e 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/auto_rest_number_test_service/models/error.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/auto_rest_number_test_service/models/error.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/auto_rest_number_test_service/operations/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/auto_rest_number_test_service/operations/__init__.py index 9b6dd2cab..fcb79709d 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/auto_rest_number_test_service/operations/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/auto_rest_number_test_service/operations/__init__.py @@ -4,13 +4,13 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from .number import number +from .number import Number __all__ = [ - 'number', + 'Number', ] diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/auto_rest_number_test_service/operations/number.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/auto_rest_number_test_service/operations/number.py index 07b7a55da..117e89399 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/auto_rest_number_test_service/operations/number.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/auto_rest_number_test_service/operations/number.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class number(object): +class Number(object): def __init__(self, client, config, serializer, derserializer): @@ -29,22 +29,18 @@ class number(object): def get_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get null Number value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: float or (float, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/number/null' @@ -79,22 +75,18 @@ class number(object): def get_invalid_float( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get invalid float Number value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: float or (float, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/number/invalidfloat' @@ -129,22 +121,18 @@ class number(object): def get_invalid_double( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get invalid double Number value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: float or (float, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/number/invaliddouble' @@ -179,22 +167,18 @@ class number(object): def get_invalid_decimal( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get invalid decimal Number value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: decimal or (decimal, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/number/invaliddecimal' @@ -229,23 +213,19 @@ class number(object): def put_big_float( self, number_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put big float value 3.402823e+20 :param number_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type number_body: float + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type number_body: float - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/number/big/float/3.402823e+20' @@ -277,22 +257,18 @@ class number(object): def get_big_float( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get big float value 3.402823e+20 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: float or (float, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/number/big/float/3.402823e+20' @@ -327,23 +303,19 @@ class number(object): def put_big_double( self, number_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put big double value 2.5976931e+101 :param number_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type number_body: float + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type number_body: float - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/number/big/double/2.5976931e+101' @@ -375,22 +347,18 @@ class number(object): def get_big_double( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get big double value 2.5976931e+101 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: float or (float, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/number/big/double/2.5976931e+101' @@ -425,23 +393,19 @@ class number(object): def put_big_double_positive_decimal( self, number_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put big double value 99999999.99 :param number_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type number_body: float + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type number_body: float - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/number/big/double/99999999.99' @@ -473,22 +437,18 @@ class number(object): def get_big_double_positive_decimal( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get big double value 99999999.99 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: float or (float, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/number/big/double/99999999.99' @@ -523,23 +483,19 @@ class number(object): def put_big_double_negative_decimal( self, number_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put big double value -99999999.99 :param number_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type number_body: float + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type number_body: float - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/number/big/double/-99999999.99' @@ -571,22 +527,18 @@ class number(object): def get_big_double_negative_decimal( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get big double value -99999999.99 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: float or (float, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/number/big/double/-99999999.99' @@ -621,23 +573,19 @@ class number(object): def put_big_decimal( self, number_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put big decimal value 2.5976931e+101 :param number_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type number_body: decimal + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type number_body: decimal - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/number/big/decimal/2.5976931e+101' @@ -669,22 +617,18 @@ class number(object): def get_big_decimal( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get big decimal value 2.5976931e+101 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: decimal or (decimal, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/number/big/decimal/2.5976931e+101' @@ -719,23 +663,19 @@ class number(object): def put_big_decimal_positive_decimal( self, number_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put big decimal value 99999999.99 :param number_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type number_body: decimal + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type number_body: decimal - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/number/big/decimal/99999999.99' @@ -767,22 +707,18 @@ class number(object): def get_big_decimal_positive_decimal( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get big decimal value 99999999.99 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: decimal or (decimal, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/number/big/decimal/99999999.99' @@ -817,23 +753,19 @@ class number(object): def put_big_decimal_negative_decimal( self, number_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put big decimal value -99999999.99 :param number_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type number_body: decimal + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type number_body: decimal - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/number/big/decimal/-99999999.99' @@ -865,22 +797,18 @@ class number(object): def get_big_decimal_negative_decimal( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get big decimal value -99999999.99 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: decimal or (decimal, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/number/big/decimal/-99999999.99' @@ -915,23 +843,19 @@ class number(object): def put_small_float( self, number_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put small float value 3.402823e-20 :param number_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type number_body: float + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type number_body: float - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/number/small/float/3.402823e-20' @@ -963,22 +887,18 @@ class number(object): def get_small_float( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get big double value 3.402823e-20 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: float or (float, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/number/small/float/3.402823e-20' @@ -1013,23 +933,19 @@ class number(object): def put_small_double( self, number_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put small double value 2.5976931e-101 :param number_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type number_body: float + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type number_body: float - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/number/small/double/2.5976931e-101' @@ -1061,22 +977,18 @@ class number(object): def get_small_double( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get big double value 2.5976931e-101 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: float or (float, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/number/small/double/2.5976931e-101' @@ -1111,23 +1023,19 @@ class number(object): def put_small_decimal( self, number_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put small decimal value 2.5976931e-101 :param number_body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type number_body: decimal + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type number_body: decimal - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/number/small/decimal/2.5976931e-101' @@ -1159,22 +1067,18 @@ class number(object): def get_small_decimal( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get small decimal value 2.5976931e-101 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: decimal or (decimal, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/number/small/decimal/2.5976931e-101' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/setup.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/setup.py index 9823ed7c6..0d242addd 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/setup.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/setup.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -22,7 +22,7 @@ VERSION = "1.0.0" # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.10", "six >= 1.9", "certifi", "python-dateutil"] +REQUIRES = ["msrest>=0.0.1"] setup( name=NAME, diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/__init__.py index 4adfa09e0..e78cb1f9c 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/api_client.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/api_client.py index 2e04dfedb..39998062b 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/api_client.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/api_client.py @@ -4,15 +4,15 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- from msrest.service_client import ServiceClient from msrest import Configuration, Serializer, Deserializer -from .operations.string import string -from .operations.enum import enum +from .operations.string import String +from .operations.enum import Enum from . import models @@ -40,7 +40,7 @@ class AutoRestSwaggerBATService(object): self._deserialize = Deserializer(client_models) self.config = config - self.string = string( + self.string = String( self._client, self.config, self._serialize, self._deserialize) - self.enum = enum( + self.enum = Enum( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/models/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/models/__init__.py index d7dc64c6a..eaf74c1d0 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/models/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/models/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/models/enums.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/models/enums.py index 7dfdaffa2..78b68498a 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/models/enums.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/models/enums.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/models/error.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/models/error.py index 1413fe073..d6b15c22e 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/models/error.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/models/error.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/operations/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/operations/__init__.py index ab78a1367..eb3d6c045 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/operations/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/operations/__init__.py @@ -4,15 +4,15 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from .string import string -from .enum import enum +from .string import String +from .enum import Enum __all__ = [ - 'string', - 'enum', + 'String', + 'Enum', ] diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/operations/enum.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/operations/enum.py index cb6572fda..8f5e5f6d2 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/operations/enum.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/operations/enum.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class enum(object): +class Enum(object): def __init__(self, client, config, serializer, derserializer): @@ -29,22 +29,18 @@ class enum(object): def get_not_expandable( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get enum value 'red color' from enumeration of 'red color', 'green-color', 'blue_color'. - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: str or (str, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/string/enum/notExpandable' @@ -79,25 +75,21 @@ class enum(object): def put_not_expandable( self, string_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Sends value 'red color' from enumeration of 'red color', 'green-color', 'blue_color' :param string_body: Possible values for this parameter include: 'red color', 'green-color', 'blue_color' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type string_body: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type string_body: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/string/enum/notExpandable' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/operations/string.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/operations/string.py index c40ccc074..e6ecbc739 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/operations/string.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/auto_rest_swagger_bat_service/operations/string.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class string(object): +class String(object): def __init__(self, client, config, serializer, derserializer): @@ -29,21 +29,17 @@ class string(object): def get_null( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get null string value value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: str or (str, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/string/null' @@ -78,23 +74,19 @@ class string(object): def put_null( self, string_body=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Set string value null :param string_body: Possible values for this parameter include: '' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type string_body: str or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type string_body: str or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/string/null' @@ -129,21 +121,17 @@ class string(object): def get_empty( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get empty string value value '' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: str or (str, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/string/empty' @@ -178,23 +166,19 @@ class string(object): def put_empty( self, string_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Set string value empty '' :param string_body: Possible values for this parameter include: '' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type string_body: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type string_body: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/string/empty' @@ -226,23 +210,19 @@ class string(object): def get_mbcs( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get mbcs string value '啊齄丂狛狜隣郎隣兀﨩ˊ▇█〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€ ' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: str or (str, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/string/mbcs' @@ -277,7 +257,6 @@ class string(object): def put_mbcs( self, string_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Set string value mbcs '啊齄丂狛狜隣郎隣兀﨩ˊ▇█〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€ ' @@ -285,19 +264,16 @@ class string(object): :param string_body: Possible values for this parameter include: '啊齄丂狛狜隣郎隣兀﨩ˊ▇█〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€ ' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type string_body: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type string_body: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/string/mbcs' @@ -329,23 +305,19 @@ class string(object): def get_whitespace( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get string value with leading and trailing whitespace 'Now is the time for all good men to come to the aid of their country' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: str or (str, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/string/whitespace' @@ -380,7 +352,6 @@ class string(object): def put_whitespace( self, string_body, custom_headers={}, raw=False, callback=None, **operation_config): """ - Set String value with leading and trailing whitespace 'Now is the time for all good men to come to the aid of their country' @@ -388,19 +359,16 @@ class string(object): :param string_body: Possible values for this parameter include: ' Now is the time for all good men to come to the aid of their country ' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type string_body: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type string_body: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/string/whitespace' @@ -432,21 +400,17 @@ class string(object): def get_not_provided( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get String value when no string value is sent in response payload - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: str or (str, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/string/notProvided' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/setup.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/setup.py index 9cef9c271..7b2cf2613 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/setup.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/setup.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -22,7 +22,7 @@ VERSION = "1.0.0" # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.10", "six >= 1.9", "certifi", "python-dateutil"] +REQUIRES = ["msrest>=0.0.1"] setup( name=NAME, diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/auto_rest_swagger_bat_header_service/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/auto_rest_swagger_bat_header_service/__init__.py index 4eeb7ac15..58d23ea15 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/auto_rest_swagger_bat_header_service/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/auto_rest_swagger_bat_header_service/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/auto_rest_swagger_bat_header_service/api_client.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/auto_rest_swagger_bat_header_service/api_client.py index c8cc8a482..266942489 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/auto_rest_swagger_bat_header_service/api_client.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/auto_rest_swagger_bat_header_service/api_client.py @@ -4,14 +4,14 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- from msrest.service_client import ServiceClient from msrest import Configuration, Serializer, Deserializer -from .operations.header import header +from .operations.header import Header from . import models @@ -39,5 +39,5 @@ class AutoRestSwaggerBATHeaderService(object): self._deserialize = Deserializer(client_models) self.config = config - self.header = header( + self.header = Header( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/auto_rest_swagger_bat_header_service/models/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/auto_rest_swagger_bat_header_service/models/__init__.py index 6250d63df..d9ce0ffdc 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/auto_rest_swagger_bat_header_service/models/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/auto_rest_swagger_bat_header_service/models/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/auto_rest_swagger_bat_header_service/models/enums.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/auto_rest_swagger_bat_header_service/models/enums.py index 2a61e7896..52bcf15a3 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/auto_rest_swagger_bat_header_service/models/enums.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/auto_rest_swagger_bat_header_service/models/enums.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/auto_rest_swagger_bat_header_service/models/error.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/auto_rest_swagger_bat_header_service/models/error.py index 1413fe073..d6b15c22e 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/auto_rest_swagger_bat_header_service/models/error.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/auto_rest_swagger_bat_header_service/models/error.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/auto_rest_swagger_bat_header_service/operations/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/auto_rest_swagger_bat_header_service/operations/__init__.py index b4d7f8e31..cf415eafb 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/auto_rest_swagger_bat_header_service/operations/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/auto_rest_swagger_bat_header_service/operations/__init__.py @@ -4,13 +4,13 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from .header import header +from .header import Header __all__ = [ - 'header', + 'Header', ] diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/auto_rest_swagger_bat_header_service/operations/header.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/auto_rest_swagger_bat_header_service/operations/header.py index ba91308d9..45d2d7d08 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/auto_rest_swagger_bat_header_service/operations/header.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/auto_rest_swagger_bat_header_service/operations/header.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class header(object): +class Header(object): def __init__(self, client, config, serializer, derserializer): @@ -29,24 +29,20 @@ class header(object): def param_existing_key( self, user_agent, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a post request with header value "User-Agent": "overwrite" :param user_agent: Send a post request with header value "User-Agent": "overwrite" - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type user_agent: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type user_agent: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/header/param/existingkey' @@ -75,21 +71,17 @@ class header(object): def response_existing_key( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get a response with header value "User-Agent": "overwrite" - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/header/response/existingkey' @@ -120,24 +112,20 @@ class header(object): def param_protected_key( self, content_type, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a post request with header value "Content-Type": "text/html" :param content_type: Send a post request with header value "Content-Type": "text/html" - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type content_type: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type content_type: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/header/param/protectedkey' @@ -166,21 +154,17 @@ class header(object): def response_protected_key( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get a response with header value "Content-Type": "text/html" - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/header/response/protectedkey' @@ -211,27 +195,23 @@ class header(object): def param_integer( self, scenario, value, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a post request with header values "scenario": "positive", "value": 1 or "scenario": "negative", "value": -2 :param scenario: Send a post request with header values "scenario": "positive" or "negative" + :type scenario: str :param value: Send a post request with header values 1 or -2 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type value: int + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type scenario: str - :type value: int - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/header/param/prim/integer' @@ -261,24 +241,20 @@ class header(object): def response_integer( self, scenario, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get a response with header value "value": 1 or -2 :param scenario: Send a post request with header values "scenario": "positive" or "negative" - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type scenario: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type scenario: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/header/response/prim/integer' @@ -310,27 +286,23 @@ class header(object): def param_long( self, scenario, value, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a post request with header values "scenario": "positive", "value": 105 or "scenario": "negative", "value": -2 :param scenario: Send a post request with header values "scenario": "positive" or "negative" + :type scenario: str :param value: Send a post request with header values 105 or -2 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type value: long + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type scenario: str - :type value: long - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/header/param/prim/long' @@ -360,24 +332,20 @@ class header(object): def response_long( self, scenario, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get a response with header value "value": 105 or -2 :param scenario: Send a post request with header values "scenario": "positive" or "negative" - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type scenario: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type scenario: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/header/response/prim/long' @@ -409,27 +377,23 @@ class header(object): def param_float( self, scenario, value, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a post request with header values "scenario": "positive", "value": 0.07 or "scenario": "negative", "value": -3.0 :param scenario: Send a post request with header values "scenario": "positive" or "negative" + :type scenario: str :param value: Send a post request with header values 0.07 or -3.0 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type value: float + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type scenario: str - :type value: float - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/header/param/prim/float' @@ -459,24 +423,20 @@ class header(object): def response_float( self, scenario, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get a response with header value "value": 0.07 or -3.0 :param scenario: Send a post request with header values "scenario": "positive" or "negative" - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type scenario: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type scenario: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/header/response/prim/float' @@ -508,27 +468,23 @@ class header(object): def param_double( self, scenario, value, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a post request with header values "scenario": "positive", "value": 7e120 or "scenario": "negative", "value": -3.0 :param scenario: Send a post request with header values "scenario": "positive" or "negative" + :type scenario: str :param value: Send a post request with header values 7e120 or -3.0 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type value: float + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type scenario: str - :type value: float - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/header/param/prim/double' @@ -558,24 +514,20 @@ class header(object): def response_double( self, scenario, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get a response with header value "value": 7e120 or -3.0 :param scenario: Send a post request with header values "scenario": "positive" or "negative" - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type scenario: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type scenario: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/header/response/prim/double' @@ -607,27 +559,23 @@ class header(object): def param_bool( self, scenario, value, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a post request with header values "scenario": "true", "value": true or "scenario": "false", "value": false :param scenario: Send a post request with header values "scenario": "true" or "false" + :type scenario: str :param value: Send a post request with header values true or false - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type value: bool + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type scenario: str - :type value: bool - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/header/param/prim/bool' @@ -657,24 +605,20 @@ class header(object): def response_bool( self, scenario, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get a response with header value "value": true or false :param scenario: Send a post request with header values "scenario": "true" or "false" - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type scenario: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type scenario: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/header/response/prim/bool' @@ -706,29 +650,25 @@ class header(object): def param_string( self, scenario, value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a post request with header values "scenario": "valid", "value": "The quick brown fox jumps over the lazy dog" or "scenario": "null", "value": null or "scenario": "empty", "value": "" :param scenario: Send a post request with header values "scenario": "valid" or "null" or "empty" + :type scenario: str :param value: Send a post request with header values "The quick brown fox jumps over the lazy dog" or null or "" - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type value: str or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type scenario: str - :type value: str or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/header/param/prim/string' @@ -759,25 +699,21 @@ class header(object): def response_string( self, scenario, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get a response with header values "The quick brown fox jumps over the lazy dog" or null or "" :param scenario: Send a post request with header values "scenario": "valid" or "null" or "empty" - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type scenario: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type scenario: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/header/response/prim/string' @@ -809,28 +745,24 @@ class header(object): def param_date( self, scenario, value, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a post request with header values "scenario": "valid", "value": "2010-01-01" or "scenario": "min", "value": "0001-01-01" :param scenario: Send a post request with header values "scenario": "valid" or "min" + :type scenario: str :param value: Send a post request with header values "2010-01-01" or "0001-01-01" - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type value: date + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type scenario: str - :type value: date - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/header/param/prim/date' @@ -860,24 +792,20 @@ class header(object): def response_date( self, scenario, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get a response with header values "2010-01-01" or "0001-01-01" :param scenario: Send a post request with header values "scenario": "valid" or "min" - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type scenario: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type scenario: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/header/response/prim/date' @@ -909,29 +837,25 @@ class header(object): def param_datetime( self, scenario, value, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a post request with header values "scenario": "valid", "value": "2010-01-01T12:34:56Z" or "scenario": "min", "value": "0001-01-01T00:00:00Z" :param scenario: Send a post request with header values "scenario": "valid" or "min" + :type scenario: str :param value: Send a post request with header values "2010-01-01T12:34:56Z" or "0001-01-01T00:00:00Z" - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type value: datetime + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type scenario: str - :type value: datetime - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/header/param/prim/datetime' @@ -961,25 +885,21 @@ class header(object): def response_datetime( self, scenario, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get a response with header values "2010-01-01T12:34:56Z" or "0001-01-01T00:00:00Z" :param scenario: Send a post request with header values "scenario": "valid" or "min" - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type scenario: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type scenario: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/header/response/prim/datetime' @@ -1011,29 +931,25 @@ class header(object): def param_datetime_rfc1123( self, scenario, value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a post request with header values "scenario": "valid", "value": "Wed, 01 Jan 2010 12:34:56 GMT" or "scenario": "min", "value": "Mon, 01 Jan 0001 00:00:00 GMT" :param scenario: Send a post request with header values "scenario": "valid" or "min" + :type scenario: str :param value: Send a post request with header values "Wed, 01 Jan 2010 12:34:56 GMT" or "Mon, 01 Jan 0001 00:00:00 GMT" - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type value: datetime or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type scenario: str - :type value: datetime or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/header/param/prim/datetimerfc1123' @@ -1064,25 +980,21 @@ class header(object): def response_datetime_rfc1123( self, scenario, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get a response with header values "Wed, 01 Jan 2010 12:34:56 GMT" or "Mon, 01 Jan 0001 00:00:00 GMT" :param scenario: Send a post request with header values "scenario": "valid" or "min" - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type scenario: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type scenario: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/header/response/prim/datetimerfc1123' @@ -1114,28 +1026,24 @@ class header(object): def param_duration( self, scenario, value, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a post request with header values "scenario": "valid", "value": "P123DT22H14M12.011S" :param scenario: Send a post request with header values "scenario": "valid" + :type scenario: str :param value: Send a post request with header values "P123DT22H14M12.011S" - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type value: timedelta + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type scenario: str - :type value: timedelta - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/header/param/prim/duration' @@ -1165,24 +1073,20 @@ class header(object): def response_duration( self, scenario, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get a response with header values "P123DT22H14M12.011S" :param scenario: Send a post request with header values "scenario": "valid" - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type scenario: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type scenario: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/header/response/prim/duration' @@ -1214,27 +1118,23 @@ class header(object): def param_byte( self, scenario, value, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a post request with header values "scenario": "valid", "value": "啊齄丂狛狜隣郎隣兀﨩" :param scenario: Send a post request with header values "scenario": "valid" + :type scenario: str :param value: Send a post request with header values "啊齄丂狛狜隣郎隣兀﨩" - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type value: bytearray + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type scenario: str - :type value: bytearray - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/header/param/prim/byte' @@ -1264,24 +1164,20 @@ class header(object): def response_byte( self, scenario, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get a response with header values "啊齄丂狛狜隣郎隣兀﨩" :param scenario: Send a post request with header values "scenario": "valid" - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type scenario: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type scenario: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/header/response/prim/byte' @@ -1313,28 +1209,24 @@ class header(object): def param_enum( self, scenario, value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a post request with header values "scenario": "valid", "value": "GREY" or "scenario": "null", "value": null :param scenario: Send a post request with header values "scenario": "valid" or "null" or "empty" + :type scenario: str :param value: Send a post request with header values 'GREY' . Possible values for this parameter include: 'White', 'black', 'GREY' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type value: str or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type scenario: str - :type value: str or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/header/param/prim/enum' @@ -1365,24 +1257,20 @@ class header(object): def response_enum( self, scenario, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get a response with header values "GREY" or null :param scenario: Send a post request with header values "scenario": "valid" or "null" or "empty" - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type scenario: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type scenario: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/header/response/prim/enum' @@ -1414,22 +1302,18 @@ class header(object): def custom_request_id( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/header/custom/x-ms-client-request-id/9C4D50EE-2D56-4CD3-8152-34347DC9F2B0' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/setup.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/setup.py index 146bf50d0..bbf0ead94 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/setup.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/setup.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -22,7 +22,7 @@ VERSION = "1.0.0" # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.10", "six >= 1.9", "certifi", "python-dateutil"] +REQUIRES = ["msrest>=0.0.1"] setup( name=NAME, diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/__init__.py index 7d10c560e..a413dac29 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/api_client.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/api_client.py index c1b18bf9a..db84b1d8e 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/api_client.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/api_client.py @@ -4,20 +4,20 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- from msrest.service_client import ServiceClient from msrest import Configuration, Serializer, Deserializer -from .operations.http_failure import http_failure -from .operations.http_success import http_success -from .operations.http_redirects import http_redirects -from .operations.http_client_failure import http_client_failure -from .operations.http_server_failure import http_server_failure -from .operations.http_retry import http_retry -from .operations.multiple_responses import multiple_responses +from .operations.http_failure import HttpFailure +from .operations.http_success import HttpSuccess +from .operations.http_redirects import HttpRedirects +from .operations.http_client_failure import HttpClientFailure +from .operations.http_server_failure import HttpServerFailure +from .operations.http_retry import HttpRetry +from .operations.multiple_responses import MultipleResponses from . import models @@ -45,17 +45,17 @@ class AutoRestHttpInfrastructureTestService(object): self._deserialize = Deserializer(client_models) self.config = config - self.http_failure = http_failure( + self.http_failure = HttpFailure( self._client, self.config, self._serialize, self._deserialize) - self.http_success = http_success( + self.http_success = HttpSuccess( self._client, self.config, self._serialize, self._deserialize) - self.http_redirects = http_redirects( + self.http_redirects = HttpRedirects( self._client, self.config, self._serialize, self._deserialize) - self.http_client_failure = http_client_failure( + self.http_client_failure = HttpClientFailure( self._client, self.config, self._serialize, self._deserialize) - self.http_server_failure = http_server_failure( + self.http_server_failure = HttpServerFailure( self._client, self.config, self._serialize, self._deserialize) - self.http_retry = http_retry( + self.http_retry = HttpRetry( self._client, self.config, self._serialize, self._deserialize) - self.multiple_responses = multiple_responses( + self.multiple_responses = MultipleResponses( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/models/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/models/__init__.py index ab1ae1770..869bc0866 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/models/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/models/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/models/a.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/models/a.py index 4234f2128..dcaeec24e 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/models/a.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/models/a.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/models/b.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/models/b.py index 21c7a4402..0132e63a4 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/models/b.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/models/b.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/models/c.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/models/c.py index 869953cea..1b484bf5a 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/models/c.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/models/c.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/models/d.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/models/d.py index 6c63d5435..a5b1d9206 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/models/d.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/models/d.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/models/error.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/models/error.py index 1413fe073..d6b15c22e 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/models/error.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/models/error.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/__init__.py index 771f9c4ce..cc774608b 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/__init__.py @@ -4,25 +4,25 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from .http_failure import http_failure -from .http_success import http_success -from .http_redirects import http_redirects -from .http_client_failure import http_client_failure -from .http_server_failure import http_server_failure -from .http_retry import http_retry -from .multiple_responses import multiple_responses +from .http_failure import HttpFailure +from .http_success import HttpSuccess +from .http_redirects import HttpRedirects +from .http_client_failure import HttpClientFailure +from .http_server_failure import HttpServerFailure +from .http_retry import HttpRetry +from .multiple_responses import MultipleResponses __all__ = [ - 'http_failure', - 'http_success', - 'http_redirects', - 'http_client_failure', - 'http_server_failure', - 'http_retry', - 'multiple_responses', + 'HttpFailure', + 'HttpSuccess', + 'HttpRedirects', + 'HttpClientFailure', + 'HttpServerFailure', + 'HttpRetry', + 'MultipleResponses', ] diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/http_client_failure.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/http_client_failure.py index 1ed586d21..e8e166148 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/http_client_failure.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/http_client_failure.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class http_client_failure(object): +class HttpClientFailure(object): def __init__(self, client, config, serializer, derserializer): @@ -29,23 +29,19 @@ class http_client_failure(object): def head400( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 400 status code - should be represented in the client as an error - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/failure/client/400' @@ -73,23 +69,19 @@ class http_client_failure(object): def get400( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 400 status code - should be represented in the client as an error - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/failure/client/400' @@ -117,25 +109,21 @@ class http_client_failure(object): def put400( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 400 status code - should be represented in the client as an error :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/failure/client/400' @@ -170,25 +158,21 @@ class http_client_failure(object): def patch400( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 400 status code - should be represented in the client as an error :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/failure/client/400' @@ -223,25 +207,21 @@ class http_client_failure(object): def post400( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 400 status code - should be represented in the client as an error :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/failure/client/400' @@ -276,25 +256,21 @@ class http_client_failure(object): def delete400( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 400 status code - should be represented in the client as an error :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/failure/client/400' @@ -329,23 +305,19 @@ class http_client_failure(object): def head401( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 401 status code - should be represented in the client as an error - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/failure/client/401' @@ -373,23 +345,19 @@ class http_client_failure(object): def get402( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 402 status code - should be represented in the client as an error - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/failure/client/402' @@ -417,23 +385,19 @@ class http_client_failure(object): def get403( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 403 status code - should be represented in the client as an error - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/failure/client/403' @@ -461,25 +425,21 @@ class http_client_failure(object): def put404( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 404 status code - should be represented in the client as an error :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/failure/client/404' @@ -514,25 +474,21 @@ class http_client_failure(object): def patch405( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 405 status code - should be represented in the client as an error :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/failure/client/405' @@ -567,25 +523,21 @@ class http_client_failure(object): def post406( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 406 status code - should be represented in the client as an error :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/failure/client/406' @@ -620,25 +572,21 @@ class http_client_failure(object): def delete407( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 407 status code - should be represented in the client as an error :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/failure/client/407' @@ -673,25 +621,21 @@ class http_client_failure(object): def put409( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 409 status code - should be represented in the client as an error :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/failure/client/409' @@ -726,23 +670,19 @@ class http_client_failure(object): def head410( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 410 status code - should be represented in the client as an error - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/failure/client/410' @@ -770,23 +710,19 @@ class http_client_failure(object): def get411( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 411 status code - should be represented in the client as an error - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/failure/client/411' @@ -814,23 +750,19 @@ class http_client_failure(object): def get412( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 412 status code - should be represented in the client as an error - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/failure/client/412' @@ -858,25 +790,21 @@ class http_client_failure(object): def put413( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 413 status code - should be represented in the client as an error :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/failure/client/413' @@ -911,25 +839,21 @@ class http_client_failure(object): def patch414( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 414 status code - should be represented in the client as an error :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/failure/client/414' @@ -964,25 +888,21 @@ class http_client_failure(object): def post415( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 415 status code - should be represented in the client as an error :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/failure/client/415' @@ -1017,23 +937,19 @@ class http_client_failure(object): def get416( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 416 status code - should be represented in the client as an error - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/failure/client/416' @@ -1061,25 +977,21 @@ class http_client_failure(object): def delete417( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 417 status code - should be represented in the client as an error :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/failure/client/417' @@ -1114,23 +1026,19 @@ class http_client_failure(object): def head429( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 429 status code - should be represented in the client as an error - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/failure/client/429' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/http_failure.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/http_failure.py index 54fa6eda5..9c7bfd496 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/http_failure.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/http_failure.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class http_failure(object): +class HttpFailure(object): def __init__(self, client, config, serializer, derserializer): @@ -29,21 +29,17 @@ class http_failure(object): def get_empty_error( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get empty error form server - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: bool or (bool, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/failure/emptybody/error' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/http_redirects.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/http_redirects.py index 3ba5a9e34..75db60ccd 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/http_redirects.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/http_redirects.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class http_redirects(object): +class HttpRedirects(object): def __init__(self, client, config, serializer, derserializer): @@ -29,21 +29,17 @@ class http_redirects(object): def head300( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 300 status code and redirect to /http/success/200 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/redirect/300' @@ -74,21 +70,17 @@ class http_redirects(object): def get300( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 300 status code and redirect to /http/success/200 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: list or (list, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/redirect/300' @@ -127,21 +119,17 @@ class http_redirects(object): def head301( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 301 status code and redirect to /http/success/200 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/redirect/301' @@ -172,21 +160,17 @@ class http_redirects(object): def get301( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 301 status code and redirect to /http/success/200 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/redirect/301' @@ -217,25 +201,21 @@ class http_redirects(object): def put301( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put true Boolean value in request returns 301. This request should not be automatically redirected, but should return the received 301 to the caller for evaluation :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/redirect/301' @@ -273,21 +253,17 @@ class http_redirects(object): def head302( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 302 status code and redirect to /http/success/200 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/redirect/302' @@ -318,21 +294,17 @@ class http_redirects(object): def get302( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 302 status code and redirect to /http/success/200 - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/redirect/302' @@ -363,25 +335,21 @@ class http_redirects(object): def patch302( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Patch true Boolean value in request returns 302. This request should not be automatically redirected, but should return the received 302 to the caller for evaluation :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/redirect/302' @@ -419,25 +387,21 @@ class http_redirects(object): def post303( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Post true Boolean value in request returns 303. This request should be automatically redirected usign a get, ultimately returning a 200 status code :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/redirect/303' @@ -475,21 +439,17 @@ class http_redirects(object): def head307( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Redirect with 307, resulting in a 200 success - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/redirect/307' @@ -520,21 +480,17 @@ class http_redirects(object): def get307( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Redirect get with 307, resulting in a 200 success - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/redirect/307' @@ -565,23 +521,19 @@ class http_redirects(object): def put307( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put redirected with 307, resulting in a 200 after redirect :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/redirect/307' @@ -619,23 +571,19 @@ class http_redirects(object): def patch307( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Patch redirected with 307, resulting in a 200 after redirect :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/redirect/307' @@ -673,23 +621,19 @@ class http_redirects(object): def post307( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Post redirected with 307, resulting in a 200 after redirect :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/redirect/307' @@ -727,23 +671,19 @@ class http_redirects(object): def delete307( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Delete redirected with 307, resulting in a 200 after redirect :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/redirect/307' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/http_retry.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/http_retry.py index e478559dd..59c283da8 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/http_retry.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/http_retry.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class http_retry(object): +class HttpRetry(object): def __init__(self, client, config, serializer, derserializer): @@ -29,21 +29,17 @@ class http_retry(object): def head408( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 408 status code, then 200 after retry - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/retry/408' @@ -71,23 +67,19 @@ class http_retry(object): def put500( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 500 status code, then 200 after retry :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/retry/500' @@ -122,23 +114,19 @@ class http_retry(object): def patch500( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 500 status code, then 200 after retry :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/retry/500' @@ -173,21 +161,17 @@ class http_retry(object): def get502( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 502 status code, then 200 after retry - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/retry/502' @@ -215,23 +199,19 @@ class http_retry(object): def post503( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 503 status code, then 200 after retry :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/retry/503' @@ -266,23 +246,19 @@ class http_retry(object): def delete503( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 503 status code, then 200 after retry :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/retry/503' @@ -317,23 +293,19 @@ class http_retry(object): def put504( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 504 status code, then 200 after retry :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/retry/504' @@ -368,23 +340,19 @@ class http_retry(object): def patch504( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 504 status code, then 200 after retry :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/retry/504' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/http_server_failure.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/http_server_failure.py index 5b2d0aee9..426f45011 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/http_server_failure.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/http_server_failure.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class http_server_failure(object): +class HttpServerFailure(object): def __init__(self, client, config, serializer, derserializer): @@ -29,23 +29,19 @@ class http_server_failure(object): def head501( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 501 status code - should be represented in the client as an error - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/failure/server/501' @@ -73,23 +69,19 @@ class http_server_failure(object): def get501( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 501 status code - should be represented in the client as an error - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/failure/server/501' @@ -117,25 +109,21 @@ class http_server_failure(object): def post505( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 505 status code - should be represented in the client as an error :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/failure/server/505' @@ -170,25 +158,21 @@ class http_server_failure(object): def delete505( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 505 status code - should be represented in the client as an error :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/failure/server/505' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/http_success.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/http_success.py index a799e71db..b35f5946c 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/http_success.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/http_success.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class http_success(object): +class HttpSuccess(object): def __init__(self, client, config, serializer, derserializer): @@ -29,21 +29,17 @@ class http_success(object): def head200( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 200 status code if successful - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/success/200' @@ -71,21 +67,17 @@ class http_success(object): def get200( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get 200 success - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: bool or (bool, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/success/200' @@ -120,23 +112,19 @@ class http_success(object): def put200( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put boolean value true returning 200 success :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/success/200' @@ -171,23 +159,19 @@ class http_success(object): def patch200( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Patch true Boolean value in request returning 200 :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/success/200' @@ -222,23 +206,19 @@ class http_success(object): def post200( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Post bollean value true in request that returns a 200 :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/success/200' @@ -273,23 +253,19 @@ class http_success(object): def delete200( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Delete simple boolean value true returns 200 :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/success/200' @@ -324,23 +300,19 @@ class http_success(object): def put201( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put true Boolean value in request returns 201 :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/success/201' @@ -375,23 +347,19 @@ class http_success(object): def post201( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Post true Boolean value in request returns 201 (Created) :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/success/201' @@ -426,23 +394,19 @@ class http_success(object): def put202( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put true Boolean value in request returns 202 (Accepted) :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/success/202' @@ -477,23 +441,19 @@ class http_success(object): def patch202( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Patch true Boolean value in request returns 202 :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/success/202' @@ -528,23 +488,19 @@ class http_success(object): def post202( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Post true Boolean value in request returns 202 (Accepted) :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/success/202' @@ -579,23 +535,19 @@ class http_success(object): def delete202( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Delete true Boolean value in request returns 202 (accepted) :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/success/202' @@ -630,21 +582,17 @@ class http_success(object): def head204( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 204 status code if successful - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/success/204' @@ -672,23 +620,19 @@ class http_success(object): def put204( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Put true Boolean value in request returns 204 (no content) :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/success/204' @@ -723,23 +667,19 @@ class http_success(object): def patch204( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Patch true Boolean value in request returns 204 (no content) :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/success/204' @@ -774,23 +714,19 @@ class http_success(object): def post204( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Post true Boolean value in request returns 204 (no content) :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/success/204' @@ -825,23 +761,19 @@ class http_success(object): def delete204( self, boolean_value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Delete true Boolean value in request returns 204 (no content) :param boolean_value: Simple boolean value true - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type boolean_value: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type boolean_value: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/success/204' @@ -876,21 +808,17 @@ class http_success(object): def head404( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Return 404 status code - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/success/404' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/multiple_responses.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/multiple_responses.py index 8d2662734..5942dd1a2 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/multiple_responses.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/multiple_responses.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -16,7 +16,7 @@ from msrest.exceptions import HttpOperationError from .. import models -class multiple_responses(object): +class MultipleResponses(object): def __init__(self, client, config, serializer, derserializer): @@ -30,22 +30,17 @@ class multiple_responses(object): def get200_model204_no_model_default_error200_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 200 response with valid payload: {'statusCode': '200'} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: a or (a, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/200/A/204/none/default/Error/response/200/valid' @@ -80,22 +75,17 @@ class multiple_responses(object): def get200_model204_no_model_default_error204_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 204 response with no payload - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: a or (a, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/200/A/204/none/default/Error/response/204/none' @@ -130,22 +120,17 @@ class multiple_responses(object): def get200_model204_no_model_default_error201_invalid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 201 response with valid payload: {'statusCode': '201'} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: a or (a, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/200/A/204/none/default/Error/response/201/valid' @@ -180,22 +165,17 @@ class multiple_responses(object): def get200_model204_no_model_default_error202_none( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 202 response with no payload: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: a or (a, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/200/A/204/none/default/Error/response/202/none' @@ -230,23 +210,18 @@ class multiple_responses(object): def get200_model204_no_model_default_error400_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 400 response with valid error payload: {'status': 400, 'message': 'client error'} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: a or (a, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/200/A/204/none/default/Error/response/400/valid' @@ -281,22 +256,17 @@ class multiple_responses(object): def get200_model201_model_default_error200_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 200 response with valid payload: {'statusCode': '200'} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: a or (a, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/200/A/201/B/default/Error/response/200/valid' @@ -333,23 +303,18 @@ class multiple_responses(object): def get200_model201_model_default_error201_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 201 response with valid payload: {'statusCode': '201', 'textStatusCode': 'Created'} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: a or (a, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/200/A/201/B/default/Error/response/201/valid' @@ -386,23 +351,18 @@ class multiple_responses(object): def get200_model201_model_default_error400_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 400 response with valid payload: {'code': '400', 'message': 'client error'} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: a or (a, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/200/A/201/B/default/Error/response/400/valid' @@ -439,22 +399,18 @@ class multiple_responses(object): def get200_model_a201_model_c404_model_ddefault_error200_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 200 response with valid payload: {'statusCode': '200'} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: object or (object, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/200/A/201/C/404/D/default/Error/response/200/valid' @@ -493,22 +449,18 @@ class multiple_responses(object): def get200_model_a201_model_c404_model_ddefault_error201_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 200 response with valid payload: {'httpCode': '201'} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: object or (object, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/200/A/201/C/404/D/default/Error/response/201/valid' @@ -547,22 +499,18 @@ class multiple_responses(object): def get200_model_a201_model_c404_model_ddefault_error404_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 200 response with valid payload: {'httpStatusCode': '404'} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: object or (object, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/200/A/201/C/404/D/default/Error/response/404/valid' @@ -601,23 +549,19 @@ class multiple_responses(object): def get200_model_a201_model_c404_model_ddefault_error400_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 400 response with valid payload: {'code': '400', 'message': 'client error'} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: object or (object, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/200/A/201/C/404/D/default/Error/response/400/valid' @@ -656,21 +600,17 @@ class multiple_responses(object): def get202_none204_none_default_error202_none( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 202 response with no payload - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/202/none/204/none/default/Error/response/202/none' @@ -698,21 +638,17 @@ class multiple_responses(object): def get202_none204_none_default_error204_none( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 204 response with no payload - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/202/none/204/none/default/Error/response/204/none' @@ -740,22 +676,18 @@ class multiple_responses(object): def get202_none204_none_default_error400_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 400 response with valid payload: {'code': '400', 'message': 'client error'} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/202/none/204/none/default/Error/response/400/valid' @@ -783,21 +715,17 @@ class multiple_responses(object): def get202_none204_none_default_none202_invalid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 202 response with an unexpected payload {'property': 'value'} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/202/none/204/none/default/none/response/202/invalid' @@ -825,21 +753,17 @@ class multiple_responses(object): def get202_none204_none_default_none204_none( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 204 response with no payload - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/202/none/204/none/default/none/response/204/none' @@ -867,21 +791,17 @@ class multiple_responses(object): def get202_none204_none_default_none400_none( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 400 response with no payload - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/202/none/204/none/default/none/response/400/none' @@ -909,21 +829,17 @@ class multiple_responses(object): def get202_none204_none_default_none400_invalid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 400 response with an unexpected payload {'property': 'value'} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/202/none/204/none/default/none/response/400/invalid' @@ -951,22 +867,17 @@ class multiple_responses(object): def get_default_model_a200_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 200 response with valid payload: {'statusCode': '200'} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: a or (a, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/default/A/response/200/valid' @@ -994,22 +905,17 @@ class multiple_responses(object): def get_default_model_a200_none( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 200 response with no payload - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: a or (a, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/default/A/response/200/none' @@ -1037,22 +943,17 @@ class multiple_responses(object): def get_default_model_a400_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 400 response with valid payload: {'statusCode': '400'} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: a or (a, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/default/A/response/400/valid' @@ -1080,22 +981,17 @@ class multiple_responses(object): def get_default_model_a400_none( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 400 response with no payload - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: a or (a, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/default/A/response/400/none' @@ -1123,21 +1019,17 @@ class multiple_responses(object): def get_default_none200_invalid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 200 response with invalid payload: {'statusCode': '200'} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/default/none/response/200/invalid' @@ -1165,21 +1057,17 @@ class multiple_responses(object): def get_default_none200_none( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 200 response with no payload - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/default/none/response/200/none' @@ -1207,21 +1095,17 @@ class multiple_responses(object): def get_default_none400_invalid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 400 response with valid payload: {'statusCode': '400'} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/default/none/response/400/invalid' @@ -1249,21 +1133,17 @@ class multiple_responses(object): def get_default_none400_none( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 400 response with no payload - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/default/none/response/400/none' @@ -1291,23 +1171,18 @@ class multiple_responses(object): def get200_model_a200_none( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 200 response with no payload, when a payload is expected - client should return a null object of thde type for model A - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: a or (a, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/200/A/response/200/none' @@ -1342,22 +1217,17 @@ class multiple_responses(object): def get200_model_a200_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 200 response with payload {'statusCode': '200'} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: a or (a, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/200/A/response/200/valid' @@ -1392,22 +1262,17 @@ class multiple_responses(object): def get200_model_a200_invalid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 200 response with invalid payload {'statusCodeInvalid': '200'} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: a or (a, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/200/A/response/200/invalid' @@ -1442,23 +1307,18 @@ class multiple_responses(object): def get200_model_a400_none( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 400 response with no payload client should treat as an http error with no error model - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: a or (a, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/200/A/response/400/none' @@ -1493,22 +1353,17 @@ class multiple_responses(object): def get200_model_a400_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 200 response with payload {'statusCode': '400'} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: a or (a, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/200/A/response/400/valid' @@ -1543,22 +1398,17 @@ class multiple_responses(object): def get200_model_a400_invalid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 200 response with invalid payload {'statusCodeInvalid': '400'} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: a or (a, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/200/A/response/400/invalid' @@ -1593,22 +1443,17 @@ class multiple_responses(object): def get200_model_a202_valid( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Send a 202 response with payload {'statusCode': '202'} - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: a or (a, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/http/payloads/200/A/response/202/valid' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/setup.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/setup.py index d2eeef7b4..fc495ace3 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/setup.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/setup.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -22,7 +22,7 @@ VERSION = "1.0.0" # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.10", "six >= 1.9", "certifi", "python-dateutil"] +REQUIRES = ["msrest>=0.0.1"] setup( name=NAME, diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/auto_rest_report_service/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/auto_rest_report_service/__init__.py index 2164d26a2..c53743419 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/auto_rest_report_service/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/auto_rest_report_service/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/auto_rest_report_service/api_client.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/auto_rest_report_service/api_client.py index 4fa446d50..b62328401 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/auto_rest_report_service/api_client.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/auto_rest_report_service/api_client.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -45,22 +45,17 @@ class AutoRestReportService(object): def get_report( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get test coverage report - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or - concurrent.futures.Future + :rtype: dict or (dict, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/report' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/auto_rest_report_service/models/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/auto_rest_report_service/models/__init__.py index 1448b1ade..279ee4c88 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/auto_rest_report_service/models/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/auto_rest_report_service/models/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/auto_rest_report_service/models/error.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/auto_rest_report_service/models/error.py index 1413fe073..d6b15c22e 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/auto_rest_report_service/models/error.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/auto_rest_report_service/models/error.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/setup.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/setup.py index e48a1f8c7..46346a7db 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/setup.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/setup.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -22,7 +22,7 @@ VERSION = "1.0.0" # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.10", "six >= 1.9", "certifi", "python-dateutil"] +REQUIRES = ["msrest>=0.0.1"] setup( name=NAME, diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/__init__.py index 761895203..da5066a53 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/api_client.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/api_client.py index 4aa64da2a..1e7f7cfca 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/api_client.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/api_client.py @@ -4,15 +4,15 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- from msrest.service_client import ServiceClient from msrest import Configuration, Serializer, Deserializer -from .operations.implicit import implicit -from .operations.explicit import explicit +from .operations.implicit import Implicit +from .operations.explicit import Explicit from . import models @@ -48,7 +48,7 @@ class AutoRestRequiredOptionalTestService(object): self._deserialize = Deserializer(client_models) self.config = config - self.implicit = implicit( + self.implicit = Implicit( self._client, self.config, self._serialize, self._deserialize) - self.explicit = explicit( + self.explicit = Explicit( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/__init__.py index 765c712ef..8cbc4b4ee 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/array_optional_wrapper.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/array_optional_wrapper.py index 38eaed9b4..42b77aae0 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/array_optional_wrapper.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/array_optional_wrapper.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/array_wrapper.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/array_wrapper.py index 8beff34b7..2b98011cf 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/array_wrapper.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/array_wrapper.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/class_optional_wrapper.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/class_optional_wrapper.py index c2080a1af..6b1219b75 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/class_optional_wrapper.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/class_optional_wrapper.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/class_wrapper.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/class_wrapper.py index 057367c1d..b7f700ad8 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/class_wrapper.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/class_wrapper.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/error.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/error.py index 1413fe073..d6b15c22e 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/error.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/error.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/int_optional_wrapper.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/int_optional_wrapper.py index 7c418a646..fd635fdcb 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/int_optional_wrapper.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/int_optional_wrapper.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/int_wrapper.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/int_wrapper.py index 0fca91def..ee0ac64ac 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/int_wrapper.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/int_wrapper.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/product.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/product.py index af8ee054d..33e6f88b7 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/product.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/product.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/string_optional_wrapper.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/string_optional_wrapper.py index cc0f4fe70..1f385fae2 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/string_optional_wrapper.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/string_optional_wrapper.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/string_wrapper.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/string_wrapper.py index d1e2abd6b..633df8425 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/string_wrapper.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/models/string_wrapper.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/operations/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/operations/__init__.py index d5cc0276f..e0b8ef61f 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/operations/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/operations/__init__.py @@ -4,15 +4,15 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from .implicit import implicit -from .explicit import explicit +from .implicit import Implicit +from .explicit import Explicit __all__ = [ - 'implicit', - 'explicit', + 'Implicit', + 'Explicit', ] diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/operations/explicit.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/operations/explicit.py index 3977336cd..7d6aa1b81 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/operations/explicit.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/operations/explicit.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class explicit(object): +class Explicit(object): def __init__(self, client, config, serializer, derserializer): @@ -29,25 +29,21 @@ class explicit(object): def post_required_integer_parameter( self, body_parameter, custom_headers={}, raw=False, callback=None, **operation_config): """ - Test explicitly required integer. Please put null and the client library should throw before the request is sent. :param body_parameter: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type body_parameter: int + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type body_parameter: int - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/reqopt/requied/integer/parameter' @@ -79,23 +75,19 @@ class explicit(object): def post_optional_integer_parameter( self, body_parameter=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Test explicitly optional integer. Please put null. :param body_parameter: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type body_parameter: int or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type body_parameter: int or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/reqopt/optional/integer/parameter' @@ -130,26 +122,22 @@ class explicit(object): def post_required_integer_property( self, value, custom_headers={}, raw=False, callback=None, **operation_config): """ - Test explicitly required integer. Please put a valid int-wrapper with 'value' = null and the client library should throw before the request is sent. :param value: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type value: int + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type value: int - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - body_parameter = models.IntWrapper() if value is not None: body_parameter.value = value @@ -185,24 +173,20 @@ class explicit(object): def post_optional_integer_property( self, value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Test explicitly optional integer. Please put a valid int-wrapper with 'value' = null. :param value: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type value: int or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type value: int or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - body_parameter = models.IntOptionalWrapper() if value is not None: body_parameter.value = value @@ -241,26 +225,22 @@ class explicit(object): def post_required_integer_header( self, header_parameter, custom_headers={}, raw=False, callback=None, **operation_config): """ - Test explicitly required integer. Please put a header 'headerParameter' => null and the client library should throw before the request is sent. :param header_parameter: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type header_parameter: int + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type header_parameter: int - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/reqopt/requied/integer/header' @@ -289,24 +269,20 @@ class explicit(object): def post_optional_integer_header( self, header_parameter=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Test explicitly optional integer. Please put a header 'headerParameter' => null. :param header_parameter: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type header_parameter: int or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type header_parameter: int or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/reqopt/optional/integer/header' @@ -336,25 +312,21 @@ class explicit(object): def post_required_string_parameter( self, body_parameter, custom_headers={}, raw=False, callback=None, **operation_config): """ - Test explicitly required string. Please put null and the client library should throw before the request is sent. :param body_parameter: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type body_parameter: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type body_parameter: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/reqopt/requied/string/parameter' @@ -386,23 +358,19 @@ class explicit(object): def post_optional_string_parameter( self, body_parameter=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Test explicitly optional string. Please put null. :param body_parameter: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type body_parameter: str or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type body_parameter: str or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/reqopt/optional/string/parameter' @@ -437,26 +405,22 @@ class explicit(object): def post_required_string_property( self, value, custom_headers={}, raw=False, callback=None, **operation_config): """ - Test explicitly required string. Please put a valid string-wrapper with 'value' = null and the client library should throw before the request is sent. :param value: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type value: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type value: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - body_parameter = models.StringWrapper() if value is not None: body_parameter.value = value @@ -492,24 +456,20 @@ class explicit(object): def post_optional_string_property( self, value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Test explicitly optional integer. Please put a valid string-wrapper with 'value' = null. :param value: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type value: str or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type value: str or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - body_parameter = models.StringOptionalWrapper() if value is not None: body_parameter.value = value @@ -548,26 +508,22 @@ class explicit(object): def post_required_string_header( self, header_parameter, custom_headers={}, raw=False, callback=None, **operation_config): """ - Test explicitly required string. Please put a header 'headerParameter' => null and the client library should throw before the request is sent. :param header_parameter: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type header_parameter: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type header_parameter: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/reqopt/requied/string/header' @@ -596,24 +552,20 @@ class explicit(object): def post_optional_string_header( self, body_parameter=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Test explicitly optional string. Please put a header 'headerParameter' => null. :param body_parameter: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type body_parameter: str or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type body_parameter: str or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/reqopt/optional/string/header' @@ -643,25 +595,21 @@ class explicit(object): def post_required_class_parameter( self, body_parameter, custom_headers={}, raw=False, callback=None, **operation_config): """ - Test explicitly required complex object. Please put null and the client library should throw before the request is sent. :param body_parameter: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type body_parameter: product + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type body_parameter: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/reqopt/requied/class/parameter' @@ -693,23 +641,19 @@ class explicit(object): def post_optional_class_parameter( self, body_parameter=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Test explicitly optional complex object. Please put null. :param body_parameter: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type body_parameter: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type body_parameter: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/reqopt/optional/class/parameter' @@ -744,26 +688,22 @@ class explicit(object): def post_required_class_property( self, value, custom_headers={}, raw=False, callback=None, **operation_config): """ - Test explicitly required complex object. Please put a valid class-wrapper with 'value' = null and the client library should throw before the request is sent. :param value: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type value: product + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type value: object - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - body_parameter = models.ClassWrapper() if value is not None: body_parameter.value = value @@ -799,24 +739,20 @@ class explicit(object): def post_optional_class_property( self, value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Test explicitly optional complex object. Please put a valid class-wrapper with 'value' = null. :param value: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type value: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type value: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - body_parameter = models.ClassOptionalWrapper() if value is not None: body_parameter.value = value @@ -855,25 +791,21 @@ class explicit(object): def post_required_array_parameter( self, body_parameter, custom_headers={}, raw=False, callback=None, **operation_config): """ - Test explicitly required array. Please put null and the client library should throw before the request is sent. :param body_parameter: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type body_parameter: list + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type body_parameter: list - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/reqopt/requied/array/parameter' @@ -905,23 +837,19 @@ class explicit(object): def post_optional_array_parameter( self, body_parameter=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Test explicitly optional array. Please put null. :param body_parameter: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type body_parameter: list or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type body_parameter: list or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/reqopt/optional/array/parameter' @@ -956,26 +884,22 @@ class explicit(object): def post_required_array_property( self, value, custom_headers={}, raw=False, callback=None, **operation_config): """ - Test explicitly required array. Please put a valid array-wrapper with 'value' = null and the client library should throw before the request is sent. :param value: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type value: list + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type value: list - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - body_parameter = models.ArrayWrapper() if value is not None: body_parameter.value = value @@ -1011,24 +935,20 @@ class explicit(object): def post_optional_array_property( self, value=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Test explicitly optional array. Please put a valid array-wrapper with 'value' = null. :param value: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type value: list or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type value: list or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - body_parameter = models.ArrayOptionalWrapper() if value is not None: body_parameter.value = value @@ -1067,26 +987,22 @@ class explicit(object): def post_required_array_header( self, header_parameter, custom_headers={}, raw=False, callback=None, **operation_config): """ - Test explicitly required array. Please put a header 'headerParameter' => null and the client library should throw before the request is sent. :param header_parameter: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type header_parameter: list + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type header_parameter: list - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/reqopt/requied/array/header' @@ -1115,24 +1031,20 @@ class explicit(object): def post_optional_array_header( self, header_parameter=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Test explicitly optional integer. Please put a header 'headerParameter' => null. :param header_parameter: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type header_parameter: list or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type header_parameter: list or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/reqopt/optional/array/header' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/operations/implicit.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/operations/implicit.py index 7548283cc..3bd0b3813 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/operations/implicit.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/auto_rest_required_optional_test_service/operations/implicit.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class implicit(object): +class Implicit(object): def __init__(self, client, config, serializer, derserializer): @@ -29,24 +29,20 @@ class implicit(object): def get_required_path( self, path_parameter, custom_headers={}, raw=False, callback=None, **operation_config): """ - Test implicitly required path parameter :param path_parameter: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type path_parameter: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type path_parameter: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/reqopt/implicit/required/path/{pathParameter}' path_format_arguments = { @@ -78,23 +74,19 @@ class implicit(object): def put_optional_query( self, query_parameter=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Test implicitly optional query parameter :param query_parameter: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type query_parameter: str or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type query_parameter: str or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/reqopt/implicit/optional/query' @@ -124,23 +116,19 @@ class implicit(object): def put_optional_header( self, query_parameter=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Test implicitly optional header parameter :param query_parameter: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type query_parameter: str or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type query_parameter: str or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/reqopt/implicit/optional/header' @@ -170,23 +158,19 @@ class implicit(object): def put_optional_body( self, body_parameter=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Test implicitly optional body parameter :param body_parameter: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type body_parameter: str or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type body_parameter: str or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/reqopt/implicit/optional/body' @@ -221,22 +205,18 @@ class implicit(object): def get_required_global_path( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Test implicitly required path parameter - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/reqopt/global/required/path/{required-global-path}' path_format_arguments = { @@ -268,22 +248,18 @@ class implicit(object): def get_required_global_query( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Test implicitly required query parameter - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/reqopt/global/required/query' @@ -312,22 +288,18 @@ class implicit(object): def get_optional_global_query( self, custom_headers={}, raw=False, callback=None, **operation_config): """ - Test implicitly optional query parameter - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: error or (error, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/reqopt/global/optional/query' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/setup.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/setup.py index 03967c6f9..30ab80c5d 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/setup.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/setup.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -22,7 +22,7 @@ VERSION = "1.0.0" # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.10", "six >= 1.9", "certifi", "python-dateutil"] +REQUIRES = ["msrest>=0.0.1"] setup( name=NAME, diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/__init__.py index 7cd0b0fbf..16f3e7883 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/api_client.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/api_client.py index 04dc1bc2f..d9e811a5c 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/api_client.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/api_client.py @@ -4,16 +4,16 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- from msrest.service_client import ServiceClient from msrest import Configuration, Serializer, Deserializer -from .operations.paths import paths -from .operations.queries import queries -from .operations.path_items import path_items +from .operations.paths import Paths +from .operations.queries import Queries +from .operations.path_items import PathItems from . import models @@ -46,9 +46,9 @@ class AutoRestUrlTestService(object): self._deserialize = Deserializer(client_models) self.config = config - self.paths = paths( + self.paths = Paths( self._client, self.config, self._serialize, self._deserialize) - self.queries = queries( + self.queries = Queries( self._client, self.config, self._serialize, self._deserialize) - self.path_items = path_items( + self.path_items = PathItems( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/models/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/models/__init__.py index cc1dedf32..9a2c40ccf 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/models/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/models/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/models/enums.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/models/enums.py index 73b21123d..85a8918e8 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/models/enums.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/models/enums.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/models/error.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/models/error.py index 1413fe073..d6b15c22e 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/models/error.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/models/error.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/operations/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/operations/__init__.py index d11403102..107b0855c 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/operations/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/operations/__init__.py @@ -4,17 +4,17 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from .paths import paths -from .queries import queries -from .path_items import path_items +from .paths import Paths +from .queries import Queries +from .path_items import PathItems __all__ = [ - 'paths', - 'queries', - 'path_items', + 'Paths', + 'Queries', + 'PathItems', ] diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/operations/path_items.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/operations/path_items.py index 021c4b526..8d287b5fc 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/operations/path_items.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/operations/path_items.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class path_items(object): +class PathItems(object): def __init__(self, client, config, serializer, derserializer): @@ -29,7 +29,6 @@ class path_items(object): def get_all_with_values( self, local_string_path, path_item_string_path, local_string_query=None, path_item_string_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - send globalStringPath='globalStringPath', pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', @@ -38,27 +37,24 @@ class path_items(object): localStringQuery='localStringQuery' :param local_string_path: should contain value 'localStringPath' + :type local_string_path: str :param path_item_string_path: A string value 'pathItemStringPath' that appears in the path + :type path_item_string_path: str :param local_string_query: should contain value 'localStringQuery' + :type local_string_query: str or none :param path_item_string_query: A string value 'pathItemStringQuery' that appears as a query parameter - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type path_item_string_query: str or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type local_string_path: str - :type path_item_string_path: str - :type local_string_query: str or none - :type path_item_string_query: str or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/pathItemStringQuery/localStringQuery' path_format_arguments = { @@ -98,7 +94,6 @@ class path_items(object): def get_global_query_null( self, local_string_path, path_item_string_path, local_string_query=None, path_item_string_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - send globalStringPath='globalStringPath', pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery=null, @@ -106,27 +101,24 @@ class path_items(object): localStringQuery='localStringQuery' :param local_string_path: should contain value 'localStringPath' + :type local_string_path: str :param path_item_string_path: A string value 'pathItemStringPath' that appears in the path + :type path_item_string_path: str :param local_string_query: should contain value 'localStringQuery' + :type local_string_query: str or none :param path_item_string_query: A string value 'pathItemStringQuery' that appears as a query parameter - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type path_item_string_query: str or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type local_string_path: str - :type path_item_string_path: str - :type local_string_query: str or none - :type path_item_string_query: str or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/localStringQuery' path_format_arguments = { @@ -166,34 +158,30 @@ class path_items(object): def get_global_and_local_query_null( self, local_string_path, path_item_string_path, local_string_query=None, path_item_string_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - send globalStringPath=globalStringPath, pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery=null, pathItemStringQuery='pathItemStringQuery', localStringQuery=null :param local_string_path: should contain value 'localStringPath' + :type local_string_path: str :param path_item_string_path: A string value 'pathItemStringPath' that appears in the path + :type path_item_string_path: str :param local_string_query: should contain null value + :type local_string_query: str or none :param path_item_string_query: A string value 'pathItemStringQuery' that appears as a query parameter - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type path_item_string_query: str or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type local_string_path: str - :type path_item_string_path: str - :type local_string_query: str or none - :type path_item_string_query: str or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/null' path_format_arguments = { @@ -233,7 +221,6 @@ class path_items(object): def get_local_path_item_query_null( self, local_string_path, path_item_string_path, local_string_query=None, path_item_string_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - send globalStringPath='globalStringPath', pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', @@ -241,26 +228,23 @@ class path_items(object): localStringQuery=null :param local_string_path: should contain value 'localStringPath' + :type local_string_path: str :param path_item_string_path: A string value 'pathItemStringPath' that appears in the path + :type path_item_string_path: str :param local_string_query: should contain value null + :type local_string_query: str or none :param path_item_string_query: should contain value null - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type path_item_string_query: str or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type local_string_path: str - :type path_item_string_path: str - :type local_string_query: str or none - :type path_item_string_query: str or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/null/null' path_format_arguments = { diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/operations/paths.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/operations/paths.py index 370ad9cf6..fcb479c7e 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/operations/paths.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/operations/paths.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class paths(object): +class Paths(object): def __init__(self, client, config, serializer, derserializer): @@ -29,23 +29,19 @@ class paths(object): def get_boolean_true( self, bool_path, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get true Boolean value on path :param bool_path: true boolean value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type bool_path: bool + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type bool_path: bool - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/paths/bool/true/{boolPath}' path_format_arguments = { @@ -77,23 +73,19 @@ class paths(object): def get_boolean_false( self, bool_path, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get false Boolean value on path :param bool_path: false boolean value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type bool_path: bool + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type bool_path: bool - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/paths/bool/false/{boolPath}' path_format_arguments = { @@ -125,23 +117,19 @@ class paths(object): def get_int_one_million( self, int_path, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get '1000000' integer value :param int_path: '1000000' integer value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type int_path: int + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type int_path: int - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/paths/int/1000000/{intPath}' path_format_arguments = { @@ -173,23 +161,19 @@ class paths(object): def get_int_negative_one_million( self, int_path, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get '-1000000' integer value :param int_path: '-1000000' integer value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type int_path: int + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type int_path: int - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/paths/int/-1000000/{intPath}' path_format_arguments = { @@ -221,23 +205,19 @@ class paths(object): def get_ten_billion( self, long_path, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get '10000000000' 64 bit integer value :param long_path: '10000000000' 64 bit integer value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type long_path: long + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type long_path: long - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/paths/long/10000000000/{longPath}' path_format_arguments = { @@ -269,23 +249,19 @@ class paths(object): def get_negative_ten_billion( self, long_path, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get '-10000000000' 64 bit integer value :param long_path: '-10000000000' 64 bit integer value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type long_path: long + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type long_path: long - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/paths/long/-10000000000/{longPath}' path_format_arguments = { @@ -317,23 +293,19 @@ class paths(object): def float_scientific_positive( self, float_path, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get '1.034E+20' numeric value :param float_path: '1.034E+20'numeric value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type float_path: float + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type float_path: float - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/paths/float/1.034E+20/{floatPath}' path_format_arguments = { @@ -365,23 +337,19 @@ class paths(object): def float_scientific_negative( self, float_path, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get '-1.034E-20' numeric value :param float_path: '-1.034E-20'numeric value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type float_path: float + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type float_path: float - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/paths/float/-1.034E-20/{floatPath}' path_format_arguments = { @@ -413,23 +381,19 @@ class paths(object): def double_decimal_positive( self, double_path, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get '9999999.999' numeric value :param double_path: '9999999.999'numeric value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type double_path: float + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type double_path: float - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/paths/double/9999999.999/{doublePath}' path_format_arguments = { @@ -461,23 +425,19 @@ class paths(object): def double_decimal_negative( self, double_path, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get '-9999999.999' numeric value :param double_path: '-9999999.999'numeric value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type double_path: float + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type double_path: float - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/paths/double/-9999999.999/{doublePath}' path_format_arguments = { @@ -509,24 +469,20 @@ class paths(object): def string_unicode( self, string_path, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get '啊齄丂狛狜隣郎隣兀﨩' multi-byte string value :param string_path: '啊齄丂狛狜隣郎隣兀﨩'multi-byte string value. Possible values for this parameter include: '啊齄丂狛狜隣郎隣兀﨩' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type string_path: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type string_path: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/paths/string/unicode/{stringPath}' path_format_arguments = { @@ -558,25 +514,21 @@ class paths(object): def string_url_encoded( self, string_path, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get 'begin!*'();:@ &=+$,/?#[]end :param string_path: 'begin!*'();:@ &=+$,/?#[]end' url encoded string value. Possible values for this parameter include: 'begin!*'();:@ &=+$,/?#[]end' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type string_path: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type string_path: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/paths/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend/{stringPath}' path_format_arguments = { @@ -608,24 +560,20 @@ class paths(object): def string_empty( self, string_path, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get '' :param string_path: '' string value. Possible values for this parameter include: '' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type string_path: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type string_path: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/paths/string/empty/{stringPath}' path_format_arguments = { @@ -657,23 +605,19 @@ class paths(object): def string_null( self, string_path, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get null (should throw) :param string_path: null string value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type string_path: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type string_path: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/paths/string/null/{stringPath}' path_format_arguments = { @@ -705,24 +649,20 @@ class paths(object): def enum_valid( self, enum_path, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get using uri with 'green color' in path parameter :param enum_path: send the value green. Possible values for this parameter include: 'red color', 'green color', 'blue color' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type enum_path: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type enum_path: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/paths/enum/green%20color/{enumPath}' path_format_arguments = { @@ -754,25 +694,21 @@ class paths(object): def enum_null( self, enum_path, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get null (should throw on the client before the request is sent on wire) :param enum_path: send null should throw. Possible values for this parameter include: 'red color', 'green color', 'blue color' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type enum_path: str + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type enum_path: str - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/paths/string/null/{enumPath}' path_format_arguments = { @@ -804,24 +740,20 @@ class paths(object): def byte_multi_byte( self, byte_path, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array :param byte_path: '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type byte_path: bytearray + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type byte_path: bytearray - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/paths/byte/multibyte/{bytePath}' path_format_arguments = { @@ -853,23 +785,19 @@ class paths(object): def byte_empty( self, byte_path, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get '' as byte array :param byte_path: '' as byte array - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type byte_path: bytearray + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type byte_path: bytearray - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/paths/byte/empty/{bytePath}' path_format_arguments = { @@ -901,23 +829,19 @@ class paths(object): def byte_null( self, byte_path, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get null as byte array (should throw) :param byte_path: null as byte array (should throw) - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type byte_path: bytearray + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type byte_path: bytearray - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/paths/byte/null/{bytePath}' path_format_arguments = { @@ -949,23 +873,19 @@ class paths(object): def date_valid( self, date_path, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get '2012-01-01' as date :param date_path: '2012-01-01' as date - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type date_path: date + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type date_path: date - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/paths/date/2012-01-01/{datePath}' path_format_arguments = { @@ -997,24 +917,20 @@ class paths(object): def date_null( self, date_path, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get null as date - this should throw or be unusable on the client side, depending on date representation :param date_path: null as date (should throw) - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type date_path: date + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type date_path: date - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/paths/date/null/{datePath}' path_format_arguments = { @@ -1046,23 +962,19 @@ class paths(object): def date_time_valid( self, date_time_path, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get '2012-01-01T01:01:01Z' as date-time :param date_time_path: '2012-01-01T01:01:01Z' as date-time - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type date_time_path: datetime + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type date_time_path: datetime - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/paths/datetime/2012-01-01T01%3A01%3A01Z/{dateTimePath}' path_format_arguments = { @@ -1094,24 +1006,20 @@ class paths(object): def date_time_null( self, date_time_path, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get null as date-time, should be disallowed or throw depending on representation of date-time :param date_time_path: null as date-time - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type date_time_path: datetime + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type date_time_path: datetime - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/paths/datetime/null/{dateTimePath}' path_format_arguments = { diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/operations/queries.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/operations/queries.py index 554af6f9d..840261a46 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/operations/queries.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/auto_rest_url_test_service/operations/queries.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ from msrest.pipeline import ClientRawResponse from .. import models -class queries(object): +class Queries(object): def __init__(self, client, config, serializer, derserializer): @@ -29,23 +29,19 @@ class queries(object): def get_boolean_true( self, bool_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get true Boolean value on path :param bool_query: true boolean value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type bool_query: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type bool_query: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/bool/true' @@ -75,23 +71,19 @@ class queries(object): def get_boolean_false( self, bool_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get false Boolean value on path :param bool_query: false boolean value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type bool_query: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type bool_query: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/bool/false' @@ -121,23 +113,19 @@ class queries(object): def get_boolean_null( self, bool_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get null Boolean value on query (query string should be absent) :param bool_query: null boolean value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type bool_query: bool or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type bool_query: bool or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/bool/null' @@ -167,23 +155,19 @@ class queries(object): def get_int_one_million( self, int_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get '1000000' integer value :param int_query: '1000000' integer value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type int_query: int or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type int_query: int or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/int/1000000' @@ -213,23 +197,19 @@ class queries(object): def get_int_negative_one_million( self, int_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get '-1000000' integer value :param int_query: '-1000000' integer value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type int_query: int or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type int_query: int or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/int/-1000000' @@ -259,23 +239,19 @@ class queries(object): def get_int_null( self, int_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get null integer value (no query parameter) :param int_query: null integer value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type int_query: int or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type int_query: int or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/int/null' @@ -305,23 +281,19 @@ class queries(object): def get_ten_billion( self, long_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get '10000000000' 64 bit integer value :param long_query: '10000000000' 64 bit integer value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type long_query: long or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type long_query: long or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/long/10000000000' @@ -351,23 +323,19 @@ class queries(object): def get_negative_ten_billion( self, long_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get '-10000000000' 64 bit integer value :param long_query: '-10000000000' 64 bit integer value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type long_query: long or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type long_query: long or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/long/-10000000000' @@ -397,23 +365,19 @@ class queries(object): def get_long_null( self, long_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get 'null 64 bit integer value (no query param in uri) :param long_query: null 64 bit integer value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type long_query: long or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type long_query: long or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/long/null' @@ -443,23 +407,19 @@ class queries(object): def float_scientific_positive( self, float_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get '1.034E+20' numeric value :param float_query: '1.034E+20'numeric value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type float_query: float or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type float_query: float or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/float/1.034E+20' @@ -489,23 +449,19 @@ class queries(object): def float_scientific_negative( self, float_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get '-1.034E-20' numeric value :param float_query: '-1.034E-20'numeric value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type float_query: float or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type float_query: float or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/float/-1.034E-20' @@ -535,23 +491,19 @@ class queries(object): def float_null( self, float_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get null numeric value (no query parameter) :param float_query: null numeric value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type float_query: float or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type float_query: float or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/float/null' @@ -581,23 +533,19 @@ class queries(object): def double_decimal_positive( self, double_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get '9999999.999' numeric value :param double_query: '9999999.999'numeric value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type double_query: float or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type double_query: float or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/double/9999999.999' @@ -627,23 +575,19 @@ class queries(object): def double_decimal_negative( self, double_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get '-9999999.999' numeric value :param double_query: '-9999999.999'numeric value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type double_query: float or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type double_query: float or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/double/-9999999.999' @@ -673,23 +617,19 @@ class queries(object): def double_null( self, double_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get null numeric value (no query parameter) :param double_query: null numeric value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type double_query: float or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type double_query: float or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/double/null' @@ -719,24 +659,20 @@ class queries(object): def string_unicode( self, string_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get '啊齄丂狛狜隣郎隣兀﨩' multi-byte string value :param string_query: '啊齄丂狛狜隣郎隣兀﨩'multi-byte string value. Possible values for this parameter include: '啊齄丂狛狜隣郎隣兀﨩' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type string_query: str or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type string_query: str or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/string/unicode/' @@ -766,25 +702,21 @@ class queries(object): def string_url_encoded( self, string_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get 'begin!*'();:@ &=+$,/?#[]end :param string_query: 'begin!*'();:@ &=+$,/?#[]end' url encoded string value. Possible values for this parameter include: 'begin!*'();:@ &=+$,/?#[]end' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type string_query: str or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type string_query: str or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend' @@ -814,24 +746,20 @@ class queries(object): def string_empty( self, string_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get '' :param string_query: '' string value. Possible values for this parameter include: '' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type string_query: str or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type string_query: str or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/string/empty' @@ -861,23 +789,19 @@ class queries(object): def string_null( self, string_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get null (no query parameter in url) :param string_query: null string value - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type string_query: str or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type string_query: str or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/string/null' @@ -907,24 +831,20 @@ class queries(object): def enum_valid( self, enum_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get using uri with query parameter 'green color' :param enum_query: 'green color' enum value. Possible values for this parameter include: 'red color', 'green color', 'blue color' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type enum_query: str or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type enum_query: str or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/enum/green%20color' @@ -954,24 +874,20 @@ class queries(object): def enum_null( self, enum_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get null (no query parameter in url) :param enum_query: null string value. Possible values for this parameter include: 'red color', 'green color', 'blue color' - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type enum_query: str or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type enum_query: str or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/enum/null' @@ -1001,24 +917,20 @@ class queries(object): def byte_multi_byte( self, byte_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array :param byte_query: '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type byte_query: bytearray or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type byte_query: bytearray or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/byte/multibyte' @@ -1048,23 +960,19 @@ class queries(object): def byte_empty( self, byte_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get '' as byte array :param byte_query: '' as byte array - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type byte_query: bytearray or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type byte_query: bytearray or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/byte/empty' @@ -1094,23 +1002,19 @@ class queries(object): def byte_null( self, byte_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get null as byte array (no query parameters in uri) :param byte_query: null as byte array (no query parameters in uri) - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type byte_query: bytearray or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type byte_query: bytearray or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/byte/null' @@ -1140,23 +1044,19 @@ class queries(object): def date_valid( self, date_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get '2012-01-01' as date :param date_query: '2012-01-01' as date - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type date_query: date or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type date_query: date or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/date/2012-01-01' @@ -1186,23 +1086,19 @@ class queries(object): def date_null( self, date_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get null as date - this should result in no query parameters in uri :param date_query: null as date (no query parameters in uri) - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type date_query: date or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type date_query: date or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/date/null' @@ -1232,23 +1128,19 @@ class queries(object): def date_time_valid( self, date_time_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get '2012-01-01T01:01:01Z' as date-time :param date_time_query: '2012-01-01T01:01:01Z' as date-time - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type date_time_query: datetime or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type date_time_query: datetime or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/datetime/2012-01-01T01%3A01%3A01Z' @@ -1278,23 +1170,19 @@ class queries(object): def date_time_null( self, date_time_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get null as date-time, should result in no query parameters in uri :param date_time_query: null as date-time (no query parameters) - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type date_time_query: datetime or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type date_time_query: datetime or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/datetime/null' @@ -1324,25 +1212,21 @@ class queries(object): def array_string_csv_valid( self, array_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the csv-array format :param array_query: an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the csv-array format - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_query: list or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_query: list or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/array/csv/string/valid' @@ -1372,23 +1256,19 @@ class queries(object): def array_string_csv_null( self, array_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get a null array of string using the csv-array format :param array_query: a null array of string using the csv-array format - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_query: list or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_query: list or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/array/csv/string/null' @@ -1418,24 +1298,20 @@ class queries(object): def array_string_csv_empty( self, array_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get an empty array [] of string using the csv-array format :param array_query: an empty array [] of string using the csv-array format - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_query: list or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_query: list or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/array/csv/string/empty' @@ -1465,25 +1341,21 @@ class queries(object): def array_string_ssv_valid( self, array_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the ssv-array format :param array_query: an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the ssv-array format - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_query: list or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_query: list or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/array/ssv/string/valid' @@ -1513,25 +1385,21 @@ class queries(object): def array_string_tsv_valid( self, array_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the tsv-array format :param array_query: an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the tsv-array format - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_query: list or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_query: list or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/array/tsv/string/valid' @@ -1561,25 +1429,21 @@ class queries(object): def array_string_pipes_valid( self, array_query=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the pipes-array format :param array_query: an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the pipes-array format - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type array_query: list or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type array_query: list or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None :rtype: None or (None, requests.response) or concurrent.futures.Future """ - # Construct URL url = '/queries/array/pipes/string/valid' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/setup.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/setup.py index 1dd5dea27..5cdcfd1c2 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/setup.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/setup.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -22,7 +22,7 @@ VERSION = "1.0.0" # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.10", "six >= 1.9", "certifi", "python-dateutil"] +REQUIRES = ["msrest>=0.0.1"] setup( name=NAME, diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/auto_rest_validation_test/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/auto_rest_validation_test/__init__.py index 5853e0cfa..242f43ae8 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/auto_rest_validation_test/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/auto_rest_validation_test/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/auto_rest_validation_test/api_client.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/auto_rest_validation_test/api_client.py index a6fe8afe5..2378a7ff4 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/auto_rest_validation_test/api_client.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/auto_rest_validation_test/api_client.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -52,29 +52,25 @@ class AutoRestValidationTest(object): def validation_of_method_parameters( self, resource_group_name, id, custom_headers={}, raw=False, callback=None, **operation_config): """ - Validates input parameters on the method. See swagger for details. :param resource_group_name: Required string between 3 and 10 chars with pattern [a-zA-Z0-9]+. + :type resource_group_name: str :param id: Required int multiple of 10 from 100 to 1000. - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type id: int + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type resource_group_name: str - :type id: int - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL - url = '/fakepath/{subscriptionId}/{resourceGroupName}/{id}?api-version={apiVersion}' + url = '/fakepath/{subscriptionId}/{resourceGroupName}/{id}' path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), @@ -114,31 +110,27 @@ class AutoRestValidationTest(object): def validation_of_body( self, resource_group_name, id, body=None, custom_headers={}, raw=False, callback=None, **operation_config): """ - Validates body parameters on the method. See swagger for details. :param resource_group_name: Required string between 3 and 10 chars with pattern [a-zA-Z0-9]+. + :type resource_group_name: str :param id: Required int multiple of 10 from 100 to 1000. + :type id: int :param body: - :param custom_headers: headers that will be added to the request - :param raw: returns the direct response alongside the deserialized - response + :type body: product or none + :param dict custom_headers: headers that will be added to the request + :param boolean raw: returns the direct response alongside the + deserialized response :param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future - :type resource_group_name: str - :type id: int - :type body: object or none - :type custom_headers: dict - :type raw: boolean :type callback: Callable[[concurrent.futures.Future], None] or None - :rtype: object or (object, requests.response) or + :rtype: product or (product, requests.response) or concurrent.futures.Future """ - # Construct URL - url = '/fakepath/{subscriptionId}/{resourceGroupName}/{id}?api-version={apiVersion}' + url = '/fakepath/{subscriptionId}/{resourceGroupName}/{id}' path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/auto_rest_validation_test/models/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/auto_rest_validation_test/models/__init__.py index fedd7dfe6..e985973a5 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/auto_rest_validation_test/models/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/auto_rest_validation_test/models/__init__.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/auto_rest_validation_test/models/error.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/auto_rest_validation_test/models/error.py index 335428632..9059e0ad9 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/auto_rest_validation_test/models/error.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/auto_rest_validation_test/models/error.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/auto_rest_validation_test/models/product.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/auto_rest_validation_test/models/product.py index e0ba687a3..929b132d1 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/auto_rest_validation_test/models/product.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/auto_rest_validation_test/models/product.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/setup.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/setup.py index d0466d634..29ae110ba 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/setup.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/setup.py @@ -4,7 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -# Code generated by Microsoft (R) AutoRest Code Generator 0.13.0.0 +# Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- @@ -22,7 +22,7 @@ VERSION = "1.0.0" # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.10", "six >= 1.9", "certifi", "python-dateutil"] +REQUIRES = ["msrest>=0.0.1"] setup( name=NAME, diff --git a/AutoRest/Generators/Python/Python.Tests/Python.Tests.pyproj b/AutoRest/Generators/Python/Python.Tests/Python.Tests.pyproj index 189d47752..039b00b8d 100644 --- a/AutoRest/Generators/Python/Python.Tests/Python.Tests.pyproj +++ b/AutoRest/Generators/Python/Python.Tests/Python.Tests.pyproj @@ -26,6 +26,7 @@ false + Code @@ -103,6 +104,10 @@ + + + + diff --git a/AutoRest/Generators/Python/Python/AutoRest.Generator.Python.csproj b/AutoRest/Generators/Python/Python/AutoRest.Generator.Python.csproj index 954a6cb95..2d76e316e 100644 --- a/AutoRest/Generators/Python/Python/AutoRest.Generator.Python.csproj +++ b/AutoRest/Generators/Python/Python/AutoRest.Generator.Python.csproj @@ -31,7 +31,6 @@ - True True diff --git a/AutoRest/Generators/Python/Python/ClientModelExtensions.cs b/AutoRest/Generators/Python/Python/ClientModelExtensions.cs index 8b2147e7a..2ac605ee8 100644 --- a/AutoRest/Generators/Python/Python/ClientModelExtensions.cs +++ b/AutoRest/Generators/Python/Python/ClientModelExtensions.cs @@ -1,13 +1,12 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; -using System.Globalization; -using System.Linq; using Microsoft.Rest.Generator; using Microsoft.Rest.Generator.ClientModel; using Microsoft.Rest.Generator.Utilities; -using System.Text.RegularExpressions; +using System; +using System.Globalization; +using System.Linq; using System.Collections.Generic; using System.Text; diff --git a/AutoRest/Generators/Python/Python/PythonCodeGenerator.cs b/AutoRest/Generators/Python/Python/PythonCodeGenerator.cs index a98150aab..11f5c6f54 100644 --- a/AutoRest/Generators/Python/Python/PythonCodeGenerator.cs +++ b/AutoRest/Generators/Python/Python/PythonCodeGenerator.cs @@ -55,7 +55,7 @@ namespace Microsoft.Rest.Generator.Python /// /// the setting name /// - public override bool DoesSupportSetting(string settingName) + public override bool IsSettingSupported(string settingName) { if (settingName == "Version") return true; diff --git a/AutoRest/Generators/Python/Python/PythonCodeNamer.cs b/AutoRest/Generators/Python/Python/PythonCodeNamer.cs index 871ab0ad4..9eeba0049 100644 --- a/AutoRest/Generators/Python/Python/PythonCodeNamer.cs +++ b/AutoRest/Generators/Python/Python/PythonCodeNamer.cs @@ -159,10 +159,10 @@ namespace Microsoft.Rest.Generator.Python base.NormalizeClientModel(client); foreach (var method in client.Methods) { - if (method.Group != null) - { - method.Group = method.Group.ToPythonCase(); - } + //if (method.Group != null) + //{ + // method.Group = method.Group.ToPythonCase(); + //} var scope = new ScopeProvider(); foreach (var parameter in method.Parameters) { diff --git a/AutoRest/Generators/Python/Python/ScopeProvider.cs b/AutoRest/Generators/Python/Python/ScopeProvider.cs index 3a071c022..81bcd0d78 100644 --- a/AutoRest/Generators/Python/Python/ScopeProvider.cs +++ b/AutoRest/Generators/Python/Python/ScopeProvider.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; namespace Microsoft.Rest.Generator.Python { - public class ScopeProvider : IScopeProvider + public class ScopeProvider { // HashSet to track variable names that have been used in a scope. private readonly HashSet _variables = new HashSet(); diff --git a/AutoRest/Generators/Python/Python/TemplateModels/MethodTemplateModel.cs b/AutoRest/Generators/Python/Python/TemplateModels/MethodTemplateModel.cs index cf5dfeec2..a9d1d20f9 100644 --- a/AutoRest/Generators/Python/Python/TemplateModels/MethodTemplateModel.cs +++ b/AutoRest/Generators/Python/Python/TemplateModels/MethodTemplateModel.cs @@ -16,8 +16,6 @@ namespace Microsoft.Rest.Generator.Python { public class MethodTemplateModel : Method { - private readonly IScopeProvider _scopeProvider = new ScopeProvider(); - public MethodTemplateModel(Method source, ServiceClient serviceClient) { this.LoadFrom(source); @@ -43,11 +41,6 @@ namespace Microsoft.Rest.Generator.Python public List ParameterTemplateModels { get; private set; } - public IScopeProvider Scope - { - get { return _scopeProvider; } - } - public bool IsResponseStream { get { return this.ReturnType.Body == PrimaryType.Stream; } @@ -418,6 +411,14 @@ namespace Microsoft.Rest.Generator.Python { result = PrimaryType.String.Name; } + else if (type is DictionaryType) + { + result = "dict"; + } + else if (type is CompositeType) + { + result = type.Name; + } //If None is allowed if (!isRequired) diff --git a/AutoRest/Generators/Python/Python/TemplateModels/ModelTemplateModel.cs b/AutoRest/Generators/Python/Python/TemplateModels/ModelTemplateModel.cs index 3092f8b06..fdbf1a4b0 100644 --- a/AutoRest/Generators/Python/Python/TemplateModels/ModelTemplateModel.cs +++ b/AutoRest/Generators/Python/Python/TemplateModels/ModelTemplateModel.cs @@ -14,7 +14,6 @@ namespace Microsoft.Rest.Generator.Python { public class ModelTemplateModel : CompositeType { - private readonly IScopeProvider _scope = new ScopeProvider(); private ModelTemplateModel _parent = null; private bool _isException = false; private readonly IList _subModelTypes = new List(); @@ -89,11 +88,6 @@ namespace Microsoft.Rest.Generator.Python } } - public IScopeProvider Scope - { - get { return _scope; } - } - public ServiceClient ServiceClient { get; set; } public bool IsPolymorphic diff --git a/AutoRest/Generators/Python/Python/TemplateModels/ServiceClientTemplateModel.cs b/AutoRest/Generators/Python/Python/TemplateModels/ServiceClientTemplateModel.cs index 4afbce8ae..201ab62b2 100644 --- a/AutoRest/Generators/Python/Python/TemplateModels/ServiceClientTemplateModel.cs +++ b/AutoRest/Generators/Python/Python/TemplateModels/ServiceClientTemplateModel.cs @@ -120,6 +120,14 @@ namespace Microsoft.Rest.Generator.Python } } + public virtual string SetupRequires + { + get + { + return "\"msrest>=0.0.1\""; + } + } + public string Version { get; set; } } } \ No newline at end of file diff --git a/AutoRest/Generators/Python/Python/Templates/MethodTemplate.cshtml b/AutoRest/Generators/Python/Python/Templates/MethodTemplate.cshtml index 6092f1fe7..910f33453 100644 --- a/AutoRest/Generators/Python/Python/Templates/MethodTemplate.cshtml +++ b/AutoRest/Generators/Python/Python/Templates/MethodTemplate.cshtml @@ -9,36 +9,30 @@ @@async_request def @(Model.Name.ToPythonCase())( self, @(Model.MethodParameterDeclaration(Model.AddCustomHeader))): - """ @if (!String.IsNullOrEmpty(Model.Summary)) { -@: @WrapComment(string.Empty, Model.Summary) +@: """@WrapComment(string.Empty, Model.Summary) +} +else +{ +@: """ } @if (!String.IsNullOrEmpty(Model.Description)) { -@EmptyLine @: @WrapComment(string.Empty, Model.Description) } @EmptyLine @foreach(var parameter in Model.DocumentationParameters) { @: @WrapComment(string.Empty, ":param " + parameter.Name + ": " + parameter.Documentation) - } - @WrapComment(string.Empty, ":param custom_headers: headers that will be added to the request") - @WrapComment(string.Empty, ":param raw: returns the direct response alongside the deserialized response") - @WrapComment(string.Empty, ":param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future") - @foreach (var parameter in Model.DocumentationParameters) - { @: @WrapComment(string.Empty, ":type " + parameter.Name + ": " + MethodTemplateModel.GetDocumentationType(parameter.Type, parameter.IsRequired)) } - @WrapComment(string.Empty, ":type custom_headers: dict") - @WrapComment(string.Empty, ":type raw: boolean") + @WrapComment(string.Empty, ":param dict custom_headers: headers that will be added to the request") + @WrapComment(string.Empty, ":param boolean raw: returns the direct response alongside the deserialized response") + @WrapComment(string.Empty, ":param callback: if provided, the call will run asynchronously and call the callback when complete. When specified the function returns a concurrent.futures.Future") @WrapComment(string.Empty, ":type callback: Callable[[concurrent.futures.Future], None] or None") - @WrapComment(string.Empty, string.Format(":rtype: {0} or ({0}, requests.response) or concurrent.futures.Future", MethodTemplateModel.GetDocumentationType(Model.ReturnType.Body))) - """ -@EmptyLine @if (Model.IsResponseStream) { @@ -65,7 +59,7 @@ @EmptyLine # Construct headers header_parameters = {} - header_parameters['Content-Type'] = '@(Model.ContentType)' + header_parameters['Content-Type'] = '@(Model.RequestContentType)' @(Model.SetDefaultHeaders) @(Model.BuildHeaders("header_parameters")) @EmptyLine diff --git a/AutoRest/Generators/Python/Python/Templates/ServiceClientTemplate.cshtml b/AutoRest/Generators/Python/Python/Templates/ServiceClientTemplate.cshtml index fec71c54c..e37190c8b 100644 --- a/AutoRest/Generators/Python/Python/Templates/ServiceClientTemplate.cshtml +++ b/AutoRest/Generators/Python/Python/Templates/ServiceClientTemplate.cshtml @@ -74,7 +74,7 @@ else self.config = config @foreach (var methodGroup in Model.MethodGroupModels) { - @:self.@(methodGroup.MethodGroupName) = @(methodGroup.MethodGroupType)( + @:self.@(methodGroup.MethodGroupName.ToPythonCase()) = @(methodGroup.MethodGroupType)( @:self._client, self.config, self._serialize, self._deserialize) } @foreach (var method in Model.MethodTemplateModels) diff --git a/AutoRest/Generators/Python/Python/Templates/SetupTemplate.cshtml b/AutoRest/Generators/Python/Python/Templates/SetupTemplate.cshtml index 3d0dee0de..4acc5e79f 100644 --- a/AutoRest/Generators/Python/Python/Templates/SetupTemplate.cshtml +++ b/AutoRest/Generators/Python/Python/Templates/SetupTemplate.cshtml @@ -21,7 +21,7 @@ VERSION = "@Model.Version" # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools @EmptyLine -REQUIRES = ["urllib3 >= 1.10", "six >= 1.9", "certifi", "python-dateutil"] +REQUIRES = [@Model.SetupRequires] @EmptyLine setup( name=NAME, diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_report/azure_report.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_report/azure_report.rb deleted file mode 100644 index 686cc6c43..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_report/azure_report.rb +++ /dev/null @@ -1,31 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -require 'uri' -require 'cgi' -require 'date' -require 'json' -require 'base64' -require 'erb' -require 'securerandom' -require 'time' -require 'timeliness' -require 'faraday' -require 'faraday-cookie_jar' -require 'concurrent' -require 'ms_rest' -require 'ms_rest_azure' - -module AzureReportModule - autoload :AutoRestReportServiceForAzure, 'azure_report/auto_rest_report_service_for_azure.rb' - - module Models - autoload :Error, 'azure_report/models/error.rb' - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_report/azure_report/auto_rest_report_service_for_azure.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_report/azure_report/auto_rest_report_service_for_azure.rb deleted file mode 100644 index 400505275..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_report/azure_report/auto_rest_report_service_for_azure.rb +++ /dev/null @@ -1,136 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module AzureReportModule - # - # A service client - single point of access to the REST API. - # - class AutoRestReportServiceForAzure < MsRestAzure::AzureServiceClient - include AzureReportModule::Models - include MsRestAzure - - # @return [String] the base URI of the service. - attr_accessor :base_url - - # @return The management credentials for Azure. - attr_reader :credentials - - # @return [String] Gets or sets the preferred language for the response. - attr_accessor :accept_language - - # @return [Integer] The retry timeout for Long Running Operations. - attr_accessor :long_running_operation_retry_timeout - - # @return Subscription credentials which uniquely identify client - # subscription. - attr_accessor :credentials - - # - # Creates initializes a new instance of the AutoRestReportServiceForAzure class. - # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. - # @param base_url [String] the base URI of the service. - # @param options [Array] filters to be applied to the HTTP requests. - # - def initialize(credentials, base_url = nil, options = nil) - super(credentials, options) - @base_url = base_url || 'http://localhost' - - fail ArgumentError, 'credentials is nil' if credentials.nil? - fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) - @credentials = credentials - - @accept_language = "en-US" - end - - # - # Get test coverage report - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_report(custom_headers = nil) - # Construct URL - path = "/report/azure" - url = URI.join(self.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = accept_language unless accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - self.credentials.sign_request(request) unless self.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response.each do |key, valueElement| - valueElement = Integer(valueElement) unless valueElement.to_s.empty? - parsed_response[key] = valueElement - end - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_report/azure_report/models/error.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_report/azure_report/models/error.rb deleted file mode 100644 index c2f34b9ad..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_report/azure_report/models/error.rb +++ /dev/null @@ -1,72 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module AzureReportModule - module Models - # - # Model object. - # - class Error - - include MsRestAzure - - # @return [Integer] - attr_accessor :status - - # @return [String] - attr_accessor :message - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.status - output_object['status'] = serialized_property unless serialized_property.nil? - - serialized_property = object.message - output_object['message'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Error] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Error.new - - deserialized_property = object['status'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.status = deserialized_property - - deserialized_property = object['message'] - output_object.message = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties.rb deleted file mode 100644 index 058b9447b..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties.rb +++ /dev/null @@ -1,40 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -require 'uri' -require 'cgi' -require 'date' -require 'json' -require 'base64' -require 'erb' -require 'securerandom' -require 'time' -require 'timeliness' -require 'faraday' -require 'faraday-cookie_jar' -require 'concurrent' -require 'ms_rest' -require 'ms_rest_azure' - -module AzureSpecialPropertiesModule - autoload :XMsClientRequestId, 'azure_special_properties/xms_client_request_id.rb' - autoload :SubscriptionInCredentials, 'azure_special_properties/subscription_in_credentials.rb' - autoload :SubscriptionInMethod, 'azure_special_properties/subscription_in_method.rb' - autoload :ApiVersionDefault, 'azure_special_properties/api_version_default.rb' - autoload :ApiVersionLocal, 'azure_special_properties/api_version_local.rb' - autoload :SkipUrlEncoding, 'azure_special_properties/skip_url_encoding.rb' - autoload :Odata, 'azure_special_properties/odata.rb' - autoload :Header, 'azure_special_properties/header.rb' - autoload :AutoRestAzureSpecialParametersTestClient, 'azure_special_properties/auto_rest_azure_special_parameters_test_client.rb' - - module Models - autoload :Error, 'azure_special_properties/models/error.rb' - autoload :OdataFilter, 'azure_special_properties/models/odata_filter.rb' - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/api_version_default.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/api_version_default.rb deleted file mode 100644 index e754759c2..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/api_version_default.rb +++ /dev/null @@ -1,314 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module AzureSpecialPropertiesModule - # - # Test Infrastructure for AutoRest - # - class ApiVersionDefault - include AzureSpecialPropertiesModule::Models - include MsRestAzure - - # - # Creates and initializes a new instance of the ApiVersionDefault class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestAzureSpecialParametersTestClient - attr_reader :client - - # - # GET method with api-version modeled in global settings. - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_method_global_valid(custom_headers = nil) - fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? - # Construct URL - path = "/azurespecials/apiVersion/method/string/none/query/global/2015-07-01-preview" - url = URI.join(@client.base_url, path) - properties = {} - properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil? - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # GET method with api-version modeled in global settings. - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_method_global_not_provided_valid(custom_headers = nil) - fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? - # Construct URL - path = "/azurespecials/apiVersion/method/string/none/query/globalNotProvided/2015-07-01-preview" - url = URI.join(@client.base_url, path) - properties = {} - properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil? - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # GET method with api-version modeled in global settings. - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_path_global_valid(custom_headers = nil) - fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? - # Construct URL - path = "/azurespecials/apiVersion/path/string/none/query/global/2015-07-01-preview" - url = URI.join(@client.base_url, path) - properties = {} - properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil? - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # GET method with api-version modeled in global settings. - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_swagger_global_valid(custom_headers = nil) - fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? - # Construct URL - path = "/azurespecials/apiVersion/swagger/string/none/query/global/2015-07-01-preview" - url = URI.join(@client.base_url, path) - properties = {} - properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil? - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/api_version_local.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/api_version_local.rb deleted file mode 100644 index a6606cbdf..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/api_version_local.rb +++ /dev/null @@ -1,325 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module AzureSpecialPropertiesModule - # - # Test Infrastructure for AutoRest - # - class ApiVersionLocal - include AzureSpecialPropertiesModule::Models - include MsRestAzure - - # - # Creates and initializes a new instance of the ApiVersionLocal class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestAzureSpecialParametersTestClient - attr_reader :client - - # - # Get method with api-version modeled in the method. pass in api-version = - # '2.0' to succeed - # - # @param api_version This should appear as a method parameter, use value - # '2.0'. Possible values for this parameter include: '2.0' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_method_local_valid(api_version, custom_headers = nil) - fail ArgumentError, 'api_version is nil' if api_version.nil? - # Construct URL - path = "/azurespecials/apiVersion/method/string/none/query/local/2.0" - url = URI.join(@client.base_url, path) - properties = {} - properties['api-version'] = ERB::Util.url_encode(api_version.to_s) unless api_version.nil? - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Get method with api-version modeled in the method. pass in api-version = - # null to succeed - # - # @param api_version [String] This should appear as a method parameter, use - # value null, this should result in no serialized parameter - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_method_local_null(api_version = nil, custom_headers = nil) - # Construct URL - path = "/azurespecials/apiVersion/method/string/none/query/local/null" - url = URI.join(@client.base_url, path) - properties = {} - properties['api-version'] = ERB::Util.url_encode(api_version.to_s) unless api_version.nil? - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Get method with api-version modeled in the method. pass in api-version = - # '2.0' to succeed - # - # @param api_version This should appear as a method parameter, use value - # '2.0'. Possible values for this parameter include: '2.0' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_path_local_valid(api_version, custom_headers = nil) - fail ArgumentError, 'api_version is nil' if api_version.nil? - # Construct URL - path = "/azurespecials/apiVersion/path/string/none/query/local/2.0" - url = URI.join(@client.base_url, path) - properties = {} - properties['api-version'] = ERB::Util.url_encode(api_version.to_s) unless api_version.nil? - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Get method with api-version modeled in the method. pass in api-version = - # '2.0' to succeed - # - # @param api_version The api version, which appears in the query, the value is - # always '2.0'. Possible values for this parameter include: '2.0' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_swagger_local_valid(api_version, custom_headers = nil) - fail ArgumentError, 'api_version is nil' if api_version.nil? - # Construct URL - path = "/azurespecials/apiVersion/swagger/string/none/query/local/2.0" - url = URI.join(@client.base_url, path) - properties = {} - properties['api-version'] = ERB::Util.url_encode(api_version.to_s) unless api_version.nil? - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/auto_rest_azure_special_parameters_test_client.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/auto_rest_azure_special_parameters_test_client.rb deleted file mode 100644 index 4360b4a1c..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/auto_rest_azure_special_parameters_test_client.rb +++ /dev/null @@ -1,93 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module AzureSpecialPropertiesModule - # - # A service client - single point of access to the REST API. - # - class AutoRestAzureSpecialParametersTestClient < MsRestAzure::AzureServiceClient - include AzureSpecialPropertiesModule::Models - include MsRestAzure - - # @return [String] the base URI of the service. - attr_accessor :base_url - - # @return The management credentials for Azure. - attr_reader :credentials - - # @return [String] The subscription id, which appears in the path, always - # modeled in credentials. The value is always '1234-5678-9012-3456' - attr_accessor :subscription_id - - # @return [String] The api version, which appears in the query, the value - # is always '2015-07-01-preview' - attr_reader :api_version - - # @return [String] Gets or sets the preferred language for the response. - attr_accessor :accept_language - - # @return [Integer] The retry timeout for Long Running Operations. - attr_accessor :long_running_operation_retry_timeout - - # @return Subscription credentials which uniquely identify client - # subscription. - attr_accessor :credentials - - # @return xms_client_request_id - attr_reader :xms_client_request_id - - # @return subscription_in_credentials - attr_reader :subscription_in_credentials - - # @return subscription_in_method - attr_reader :subscription_in_method - - # @return api_version_default - attr_reader :api_version_default - - # @return api_version_local - attr_reader :api_version_local - - # @return skip_url_encoding - attr_reader :skip_url_encoding - - # @return odata - attr_reader :odata - - # @return header - attr_reader :header - - # - # Creates initializes a new instance of the AutoRestAzureSpecialParametersTestClient class. - # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. - # @param base_url [String] the base URI of the service. - # @param options [Array] filters to be applied to the HTTP requests. - # - def initialize(credentials, base_url = nil, options = nil) - super(credentials, options) - @base_url = base_url || 'http://localhost' - - fail ArgumentError, 'credentials is nil' if credentials.nil? - fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) - @credentials = credentials - - @xms_client_request_id = XMsClientRequestId.new(self) - @subscription_in_credentials = SubscriptionInCredentials.new(self) - @subscription_in_method = SubscriptionInMethod.new(self) - @api_version_default = ApiVersionDefault.new(self) - @api_version_local = ApiVersionLocal.new(self) - @skip_url_encoding = SkipUrlEncoding.new(self) - @odata = Odata.new(self) - @header = Header.new(self) - @api_version = "2015-07-01-preview" - @accept_language = "en-US" - end - - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/header.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/header.rb deleted file mode 100644 index 84560bf9c..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/header.rb +++ /dev/null @@ -1,103 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module AzureSpecialPropertiesModule - # - # Test Infrastructure for AutoRest - # - class Header - include AzureSpecialPropertiesModule::Models - include MsRestAzure - - # - # Creates and initializes a new instance of the Header class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestAzureSpecialParametersTestClient - attr_reader :client - - # - # Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the - # header of the request - # - # @param foo_client_request_id [String] The fooRequestId - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def custom_named_request_id(foo_client_request_id, custom_headers = nil) - fail ArgumentError, 'foo_client_request_id is nil' if foo_client_request_id.nil? - # Construct URL - path = "/azurespecials/customNamedRequestId" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['foo-client-request-id'] = SecureRandom.uuid - request_headers["foo-client-request-id"] = foo_client_request_id unless foo_client_request_id.nil? - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['foo-request-id'] unless http_response['foo-request-id'].nil? - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/models/error.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/models/error.rb deleted file mode 100644 index 5c318ae38..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/models/error.rb +++ /dev/null @@ -1,72 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module AzureSpecialPropertiesModule - module Models - # - # Model object. - # - class Error - - include MsRestAzure - - # @return [Integer] - attr_accessor :status - - # @return [String] - attr_accessor :message - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.status - output_object['status'] = serialized_property unless serialized_property.nil? - - serialized_property = object.message - output_object['message'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Error] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Error.new - - deserialized_property = object['status'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.status = deserialized_property - - deserialized_property = object['message'] - output_object.message = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/models/odata_filter.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/models/odata_filter.rb deleted file mode 100644 index a6f87713c..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/models/odata_filter.rb +++ /dev/null @@ -1,72 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module AzureSpecialPropertiesModule - module Models - # - # Model object. - # - class OdataFilter - - include MsRestAzure - - # @return [Integer] - attr_accessor :id - - # @return [String] - attr_accessor :name - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.id - output_object['id'] = serialized_property unless serialized_property.nil? - - serialized_property = object.name - output_object['name'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [OdataFilter] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = OdataFilter.new - - deserialized_property = object['id'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.id = deserialized_property - - deserialized_property = object['name'] - output_object.name = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/odata.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/odata.rb deleted file mode 100644 index 095071a82..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/odata.rb +++ /dev/null @@ -1,107 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module AzureSpecialPropertiesModule - # - # Test Infrastructure for AutoRest - # - class Odata - include AzureSpecialPropertiesModule::Models - include MsRestAzure - - # - # Creates and initializes a new instance of the Odata class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestAzureSpecialParametersTestClient - attr_reader :client - - # - # Specify filter parameter with value '$filter=id gt 5 and name eq - # 'foo'&$orderby=id&$top=10' - # - # @param filter [String] The filter parameter with value '$filter=id gt 5 and - # name eq 'foo''. - # @param top [Integer] The top parameter with value 10. - # @param orderby [String] The orderby parameter with value id. - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_with_filter(filter = nil, top = nil, orderby = nil, custom_headers = nil) - # Construct URL - path = "/azurespecials/odata/filter" - url = URI.join(@client.base_url, path) - properties = {} - properties['$filter'] = ERB::Util.url_encode(filter.to_s) unless filter.nil? - properties['$top'] = ERB::Util.url_encode(top.to_s) unless top.nil? - properties['$orderby'] = ERB::Util.url_encode(orderby.to_s) unless orderby.nil? - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/skip_url_encoding.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/skip_url_encoding.rb deleted file mode 100644 index 5b2317e0d..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/skip_url_encoding.rb +++ /dev/null @@ -1,543 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module AzureSpecialPropertiesModule - # - # Test Infrastructure for AutoRest - # - class SkipUrlEncoding - include AzureSpecialPropertiesModule::Models - include MsRestAzure - - # - # Creates and initializes a new instance of the SkipUrlEncoding class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestAzureSpecialParametersTestClient - attr_reader :client - - # - # Get method with unencoded path parameter with value 'path1/path2/path3' - # - # @param unencoded_path_param [String] Unencoded path parameter with value - # 'path1/path2/path3' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_method_path_valid(unencoded_path_param, custom_headers = nil) - fail ArgumentError, 'unencoded_path_param is nil' if unencoded_path_param.nil? - # Construct URL - path = "/azurespecials/skipUrlEncoding/method/path/valid/{unencodedPathParam}" - path['{unencodedPathParam}'] = unencoded_path_param if path.include?('{unencodedPathParam}') - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Get method with unencoded path parameter with value 'path1/path2/path3' - # - # @param unencoded_path_param [String] Unencoded path parameter with value - # 'path1/path2/path3' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_path_path_valid(unencoded_path_param, custom_headers = nil) - fail ArgumentError, 'unencoded_path_param is nil' if unencoded_path_param.nil? - # Construct URL - path = "/azurespecials/skipUrlEncoding/path/path/valid/{unencodedPathParam}" - path['{unencodedPathParam}'] = unencoded_path_param if path.include?('{unencodedPathParam}') - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Get method with unencoded path parameter with value 'path1/path2/path3' - # - # @param unencoded_path_param An unencoded path parameter with value - # 'path1/path2/path3'. Possible values for this parameter include: - # 'path1/path2/path3' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_swagger_path_valid(unencoded_path_param, custom_headers = nil) - fail ArgumentError, 'unencoded_path_param is nil' if unencoded_path_param.nil? - # Construct URL - path = "/azurespecials/skipUrlEncoding/swagger/path/valid/{unencodedPathParam}" - path['{unencodedPathParam}'] = unencoded_path_param.to_s if path.include?('{unencodedPathParam}') - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Get method with unencoded query parameter with value - # 'value1&q2=value2&q3=value3' - # - # @param q1 [String] Unencoded query parameter with value - # 'value1&q2=value2&q3=value3' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_method_query_valid(q1, custom_headers = nil) - fail ArgumentError, 'q1 is nil' if q1.nil? - # Construct URL - path = "/azurespecials/skipUrlEncoding/method/query/valid" - url = URI.join(@client.base_url, path) - properties = {} - properties['q1'] = q1 unless q1.nil? - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Get method with unencoded query parameter with value null - # - # @param q1 [String] Unencoded query parameter with value null - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_method_query_null(q1 = nil, custom_headers = nil) - # Construct URL - path = "/azurespecials/skipUrlEncoding/method/query/null" - url = URI.join(@client.base_url, path) - properties = {} - properties['q1'] = q1 unless q1.nil? - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Get method with unencoded query parameter with value - # 'value1&q2=value2&q3=value3' - # - # @param q1 [String] Unencoded query parameter with value - # 'value1&q2=value2&q3=value3' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_path_query_valid(q1, custom_headers = nil) - fail ArgumentError, 'q1 is nil' if q1.nil? - # Construct URL - path = "/azurespecials/skipUrlEncoding/path/query/valid" - url = URI.join(@client.base_url, path) - properties = {} - properties['q1'] = q1 unless q1.nil? - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Get method with unencoded query parameter with value - # 'value1&q2=value2&q3=value3' - # - # @param q1 An unencoded query parameter with value - # 'value1&q2=value2&q3=value3'. Possible values for this parameter include: - # 'value1&q2=value2&q3=value3' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_swagger_query_valid(q1 = nil, custom_headers = nil) - # Construct URL - path = "/azurespecials/skipUrlEncoding/swagger/query/valid" - url = URI.join(@client.base_url, path) - properties = {} - properties['q1'] = q1 unless q1.nil? - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/subscription_in_credentials.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/subscription_in_credentials.rb deleted file mode 100644 index 5bb039214..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/subscription_in_credentials.rb +++ /dev/null @@ -1,393 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module AzureSpecialPropertiesModule - # - # Test Infrastructure for AutoRest - # - class SubscriptionInCredentials - include AzureSpecialPropertiesModule::Models - include MsRestAzure - - # - # Creates and initializes a new instance of the SubscriptionInCredentials class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestAzureSpecialParametersTestClient - attr_reader :client - - # - # POST method with subscriptionId modeled in credentials. Set the credential - # subscriptionId to '1234-5678-9012-3456' to succeed - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post_method_global_valid(custom_headers = nil) - fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? - # Construct URL - path = "/azurespecials/subscriptionId/method/string/none/path/global/1234-5678-9012-3456/{subscriptionId}" - path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}') - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # POST method with subscriptionId modeled in credentials. Set the credential - # subscriptionId to null, and client-side validation should prevent you from - # making this call - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post_method_global_null(custom_headers = nil) - fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? - # Construct URL - path = "/azurespecials/subscriptionId/method/string/none/path/global/null/{subscriptionId}" - path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}') - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # POST method with subscriptionId modeled in credentials. Set the credential - # subscriptionId to '1234-5678-9012-3456' to succeed - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post_method_global_not_provided_valid(custom_headers = nil) - fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? - fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? - # Construct URL - path = "/azurespecials/subscriptionId/method/string/none/path/globalNotProvided/1234-5678-9012-3456/{subscriptionId}" - path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}') - url = URI.join(@client.base_url, path) - properties = {} - properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil? - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # POST method with subscriptionId modeled in credentials. Set the credential - # subscriptionId to '1234-5678-9012-3456' to succeed - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post_path_global_valid(custom_headers = nil) - fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? - # Construct URL - path = "/azurespecials/subscriptionId/path/string/none/path/global/1234-5678-9012-3456/{subscriptionId}" - path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}') - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # POST method with subscriptionId modeled in credentials. Set the credential - # subscriptionId to '1234-5678-9012-3456' to succeed - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post_swagger_global_valid(custom_headers = nil) - fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? - # Construct URL - path = "/azurespecials/subscriptionId/swagger/string/none/path/global/1234-5678-9012-3456/{subscriptionId}" - path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}') - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/subscription_in_method.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/subscription_in_method.rb deleted file mode 100644 index 94413c62d..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/subscription_in_method.rb +++ /dev/null @@ -1,326 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module AzureSpecialPropertiesModule - # - # Test Infrastructure for AutoRest - # - class SubscriptionInMethod - include AzureSpecialPropertiesModule::Models - include MsRestAzure - - # - # Creates and initializes a new instance of the SubscriptionInMethod class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestAzureSpecialParametersTestClient - attr_reader :client - - # - # POST method with subscriptionId modeled in the method. pass in subscription - # id = '1234-5678-9012-3456' to succeed - # - # @param subscription_id [String] This should appear as a method parameter, - # use value '1234-5678-9012-3456' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post_method_local_valid(subscription_id, custom_headers = nil) - fail ArgumentError, 'subscription_id is nil' if subscription_id.nil? - # Construct URL - path = "/azurespecials/subscriptionId/method/string/none/path/local/1234-5678-9012-3456/{subscriptionId}" - path['{subscriptionId}'] = ERB::Util.url_encode(subscription_id) if path.include?('{subscriptionId}') - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # POST method with subscriptionId modeled in the method. pass in subscription - # id = null, client-side validation should prevent you from making this call - # - # @param subscription_id [String] This should appear as a method parameter, - # use value null, client-side validation should prvenet the call - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post_method_local_null(subscription_id, custom_headers = nil) - fail ArgumentError, 'subscription_id is nil' if subscription_id.nil? - # Construct URL - path = "/azurespecials/subscriptionId/method/string/none/path/local/null/{subscriptionId}" - path['{subscriptionId}'] = ERB::Util.url_encode(subscription_id) if path.include?('{subscriptionId}') - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # POST method with subscriptionId modeled in the method. pass in subscription - # id = '1234-5678-9012-3456' to succeed - # - # @param subscription_id [String] Should appear as a method parameter -use - # value '1234-5678-9012-3456' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post_path_local_valid(subscription_id, custom_headers = nil) - fail ArgumentError, 'subscription_id is nil' if subscription_id.nil? - # Construct URL - path = "/azurespecials/subscriptionId/path/string/none/path/local/1234-5678-9012-3456/{subscriptionId}" - path['{subscriptionId}'] = ERB::Util.url_encode(subscription_id) if path.include?('{subscriptionId}') - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # POST method with subscriptionId modeled in the method. pass in subscription - # id = '1234-5678-9012-3456' to succeed - # - # @param subscription_id [String] The subscriptionId, which appears in the - # path, the value is always '1234-5678-9012-3456' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post_swagger_local_valid(subscription_id, custom_headers = nil) - fail ArgumentError, 'subscription_id is nil' if subscription_id.nil? - # Construct URL - path = "/azurespecials/subscriptionId/swagger/string/none/path/local/1234-5678-9012-3456/{subscriptionId}" - path['{subscriptionId}'] = ERB::Util.url_encode(subscription_id) if path.include?('{subscriptionId}') - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/xms_client_request_id.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/xms_client_request_id.rb deleted file mode 100644 index 3bd78ac8b..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_special_properties/azure_special_properties/xms_client_request_id.rb +++ /dev/null @@ -1,174 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module AzureSpecialPropertiesModule - # - # Test Infrastructure for AutoRest - # - class XMsClientRequestId - include AzureSpecialPropertiesModule::Models - include MsRestAzure - - # - # Creates and initializes a new instance of the XMsClientRequestId class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestAzureSpecialParametersTestClient - attr_reader :client - - # - # Get method that overwrites x-ms-client-request header with value - # 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get(custom_headers = nil) - # Construct URL - path = "/azurespecials/overwrite/x-ms-client-request-id/method/" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Get method that overwrites x-ms-client-request header with value - # 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. - # - # @param x_ms_client_request_id [String] This should appear as a method - # parameter, use value '9C4D50EE-2D56-4CD3-8152-34347DC9F2B0' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def param_get(x_ms_client_request_id, custom_headers = nil) - fail ArgumentError, 'x_ms_client_request_id is nil' if x_ms_client_request_id.nil? - # Construct URL - path = "/azurespecials/overwrite/x-ms-client-request-id/via-param/method/" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["x-ms-client-request-id"] = x_ms_client_request_id unless x_ms_client_request_id.nil? - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_url/subscription_id_api_version.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_url/subscription_id_api_version.rb deleted file mode 100644 index 2a7d9f3c6..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_url/subscription_id_api_version.rb +++ /dev/null @@ -1,33 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -require 'uri' -require 'cgi' -require 'date' -require 'json' -require 'base64' -require 'erb' -require 'securerandom' -require 'time' -require 'timeliness' -require 'faraday' -require 'faraday-cookie_jar' -require 'concurrent' -require 'ms_rest' -require 'ms_rest_azure' - -module AzureUrlModule - autoload :Group, 'subscription_id_api_version/group.rb' - autoload :MicrosoftAzureTestUrl, 'subscription_id_api_version/microsoft_azure_test_url.rb' - - module Models - autoload :SampleResourceGroup, 'subscription_id_api_version/models/sample_resource_group.rb' - autoload :Error, 'subscription_id_api_version/models/error.rb' - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_url/subscription_id_api_version/group.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_url/subscription_id_api_version/group.rb deleted file mode 100644 index c0b7b9967..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_url/subscription_id_api_version/group.rb +++ /dev/null @@ -1,118 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module AzureUrlModule - # - # Some cool documentation. - # - class Group - include AzureUrlModule::Models - include MsRestAzure - - # - # Creates and initializes a new instance of the Group class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the MicrosoftAzureTestUrl - attr_reader :client - - # - # Provides a resouce group with name 'testgroup101' and location 'West US'. - # - # @param resource_group_name [String] Resource Group name 'testgroup101'. - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_sample_resource_group(resource_group_name, custom_headers = nil) - fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? - fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? - fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? - # Construct URL - path = "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}" - path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}') - path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}') - url = URI.join(@client.base_url, path) - properties = {} - properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil? - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = SampleResourceGroup.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_url/subscription_id_api_version/microsoft_azure_test_url.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_url/subscription_id_api_version/microsoft_azure_test_url.rb deleted file mode 100644 index 407649e6a..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_url/subscription_id_api_version/microsoft_azure_test_url.rb +++ /dev/null @@ -1,63 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module AzureUrlModule - # - # A service client - single point of access to the REST API. - # - class MicrosoftAzureTestUrl < MsRestAzure::AzureServiceClient - include AzureUrlModule::Models - include MsRestAzure - - # @return [String] the base URI of the service. - attr_accessor :base_url - - # @return The management credentials for Azure. - attr_reader :credentials - - # @return [String] Subscription Id. - attr_accessor :subscription_id - - # @return [String] API Version with value '2014-04-01-preview'. - attr_reader :api_version - - # @return [String] Gets or sets the preferred language for the response. - attr_accessor :accept_language - - # @return [Integer] The retry timeout for Long Running Operations. - attr_accessor :long_running_operation_retry_timeout - - # @return Subscription credentials which uniquely identify client - # subscription. - attr_accessor :credentials - - # @return group - attr_reader :group - - # - # Creates initializes a new instance of the MicrosoftAzureTestUrl class. - # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. - # @param base_url [String] the base URI of the service. - # @param options [Array] filters to be applied to the HTTP requests. - # - def initialize(credentials, base_url = nil, options = nil) - super(credentials, options) - @base_url = base_url || 'https://management.azure.com/' - - fail ArgumentError, 'credentials is nil' if credentials.nil? - fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) - @credentials = credentials - - @group = Group.new(self) - @api_version = "2014-04-01-preview" - @accept_language = "en-US" - end - - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_url/subscription_id_api_version/models/error.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_url/subscription_id_api_version/models/error.rb deleted file mode 100644 index 6e8259d3c..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_url/subscription_id_api_version/models/error.rb +++ /dev/null @@ -1,72 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module AzureUrlModule - module Models - # - # Model object. - # - class Error - - include MsRestAzure - - # @return [Integer] - attr_accessor :code - - # @return [String] - attr_accessor :message - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.code - output_object['code'] = serialized_property unless serialized_property.nil? - - serialized_property = object.message - output_object['message'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Error] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Error.new - - deserialized_property = object['code'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.code = deserialized_property - - deserialized_property = object['message'] - output_object.message = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_url/subscription_id_api_version/models/sample_resource_group.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_url/subscription_id_api_version/models/sample_resource_group.rb deleted file mode 100644 index 89dd003d3..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/azure_url/subscription_id_api_version/models/sample_resource_group.rb +++ /dev/null @@ -1,71 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module AzureUrlModule - module Models - # - # Model object. - # - class SampleResourceGroup - - include MsRestAzure - - # @return [String] resource group name 'testgroup101' - attr_accessor :name - - # @return [String] resource group location 'West US' - attr_accessor :location - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.name - output_object['name'] = serialized_property unless serialized_property.nil? - - serialized_property = object.location - output_object['location'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [SampleResourceGroup] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = SampleResourceGroup.new - - deserialized_property = object['name'] - output_object.name = deserialized_property - - deserialized_property = object['location'] - output_object.location = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/head/head.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/head/head.rb deleted file mode 100644 index be3e518ee..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/head/head.rb +++ /dev/null @@ -1,31 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -require 'uri' -require 'cgi' -require 'date' -require 'json' -require 'base64' -require 'erb' -require 'securerandom' -require 'time' -require 'timeliness' -require 'faraday' -require 'faraday-cookie_jar' -require 'concurrent' -require 'ms_rest' -require 'ms_rest_azure' - -module HeadModule - autoload :HttpSuccess, 'head/http_success.rb' - autoload :AutoRestHeadTestService, 'head/auto_rest_head_test_service.rb' - - module Models - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/head/head/auto_rest_head_test_service.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/head/head/auto_rest_head_test_service.rb deleted file mode 100644 index 5671b6b71..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/head/head/auto_rest_head_test_service.rb +++ /dev/null @@ -1,55 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module HeadModule - # - # A service client - single point of access to the REST API. - # - class AutoRestHeadTestService < MsRestAzure::AzureServiceClient - include MsRestAzure - - # @return [String] the base URI of the service. - attr_accessor :base_url - - # @return The management credentials for Azure. - attr_reader :credentials - - # @return [String] Gets or sets the preferred language for the response. - attr_accessor :accept_language - - # @return [Integer] The retry timeout for Long Running Operations. - attr_accessor :long_running_operation_retry_timeout - - # @return Subscription credentials which uniquely identify client - # subscription. - attr_accessor :credentials - - # @return http_success - attr_reader :http_success - - # - # Creates initializes a new instance of the AutoRestHeadTestService class. - # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. - # @param base_url [String] the base URI of the service. - # @param options [Array] filters to be applied to the HTTP requests. - # - def initialize(credentials, base_url = nil, options = nil) - super(credentials, options) - @base_url = base_url || 'http://localhost' - - fail ArgumentError, 'credentials is nil' if credentials.nil? - fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) - @credentials = credentials - - @http_success = HttpSuccess.new(self) - @accept_language = "en-US" - end - - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/head/head/http_success.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/head/head/http_success.rb deleted file mode 100644 index 932cee529..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/head/head/http_success.rb +++ /dev/null @@ -1,239 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module HeadModule - # - # Test Infrastructure for AutoRest - # - class HttpSuccess - include MsRestAzure - - # - # Creates and initializes a new instance of the HttpSuccess class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestHeadTestService - attr_reader :client - - # - # Return 200 status code if successful - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def head200(custom_headers = nil) - # Construct URL - path = "/http/success/200" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.head do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 404) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.body = (status_code == 200) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Return 204 status code if successful - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def head204(custom_headers = nil) - # Construct URL - path = "/http/success/204" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.head do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 204 || status_code == 404) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.body = (status_code == 204) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Return 404 status code if successful - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def head404(custom_headers = nil) - # Construct URL - path = "/http/success/404" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.head do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 204 || status_code == 404) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.body = (status_code == 204) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro.rb deleted file mode 100644 index a68ae451a..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro.rb +++ /dev/null @@ -1,41 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -require 'uri' -require 'cgi' -require 'date' -require 'json' -require 'base64' -require 'erb' -require 'securerandom' -require 'time' -require 'timeliness' -require 'faraday' -require 'faraday-cookie_jar' -require 'concurrent' -require 'ms_rest' -require 'ms_rest_azure' - -module LroModule - autoload :LROs, 'lro/lros.rb' - autoload :LRORetrys, 'lro/lroretrys.rb' - autoload :LROSADs, 'lro/lrosads.rb' - autoload :LROsCustomHeader, 'lro/lros_custom_header.rb' - autoload :AutoRestLongRunningOperationTestService, 'lro/auto_rest_long_running_operation_test_service.rb' - - module Models - autoload :Sku, 'lro/models/sku.rb' - autoload :ProductProperties, 'lro/models/product_properties.rb' - autoload :SubProductProperties, 'lro/models/sub_product_properties.rb' - autoload :OperationResult, 'lro/models/operation_result.rb' - autoload :OperationResultError, 'lro/models/operation_result_error.rb' - autoload :Product, 'lro/models/product.rb' - autoload :SubProduct, 'lro/models/sub_product.rb' - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/auto_rest_long_running_operation_test_service.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/auto_rest_long_running_operation_test_service.rb deleted file mode 100644 index e5e2d2578..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/auto_rest_long_running_operation_test_service.rb +++ /dev/null @@ -1,68 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module LroModule - # - # A service client - single point of access to the REST API. - # - class AutoRestLongRunningOperationTestService < MsRestAzure::AzureServiceClient - include LroModule::Models - include MsRestAzure - - # @return [String] the base URI of the service. - attr_accessor :base_url - - # @return The management credentials for Azure. - attr_reader :credentials - - # @return [String] Gets or sets the preferred language for the response. - attr_accessor :accept_language - - # @return [Integer] The retry timeout for Long Running Operations. - attr_accessor :long_running_operation_retry_timeout - - # @return Subscription credentials which uniquely identify client - # subscription. - attr_accessor :credentials - - # @return lros - attr_reader :lros - - # @return lroretrys - attr_reader :lroretrys - - # @return lrosads - attr_reader :lrosads - - # @return lros_custom_header - attr_reader :lros_custom_header - - # - # Creates initializes a new instance of the AutoRestLongRunningOperationTestService class. - # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. - # @param base_url [String] the base URI of the service. - # @param options [Array] filters to be applied to the HTTP requests. - # - def initialize(credentials, base_url = nil, options = nil) - super(credentials, options) - @base_url = base_url || 'http://localhost' - - fail ArgumentError, 'credentials is nil' if credentials.nil? - fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) - @credentials = credentials - - @lros = LROs.new(self) - @lroretrys = LRORetrys.new(self) - @lrosads = LROSADs.new(self) - @lros_custom_header = LROsCustomHeader.new(self) - @accept_language = "en-US" - end - - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/lroretrys.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/lroretrys.rb deleted file mode 100644 index 3f6812296..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/lroretrys.rb +++ /dev/null @@ -1,822 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module LroModule - # - # Long-running Operation for AutoRest - # - class LRORetrys - include LroModule::Models - include MsRestAzure - - # - # Creates and initializes a new instance of the LRORetrys class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestLongRunningOperationTestService - attr_reader :client - - # - # Long running put request, service returns a 500, then a 201 to the initial - # request, with an entity that contains ProvisioningState=’Creating’. Polls - # return this value until the last poll returns a ‘200’ with - # ProvisioningState=’Succeeded’ - # - # @param product [Product] Product to put - # @param @client.accept_language [String] Gets or sets the preferred language - # for the response. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def put201creating_succeeded200(product = nil, custom_headers = nil) - # Send request - promise = begin_put201creating_succeeded200(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_put_operation_result(response, custom_headers, deserialize_method) - end - - promise - end - - # - # Long running put request, service returns a 500, then a 201 to the initial - # request, with an entity that contains ProvisioningState=’Creating’. Polls - # return this value until the last poll returns a ‘200’ with - # ProvisioningState=’Succeeded’ - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_put201creating_succeeded200(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/retryerror/put/201/creating/succeeded/200" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 201) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - # Deserialize Response - if status_code == 201 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running put request, service returns a 500, then a 200 to the initial - # request, with an entity that contains ProvisioningState=’Creating’. Poll - # the endpoint indicated in the Azure-AsyncOperation header for operation - # status - # - # @param product [Product] Product to put - # @param @client.accept_language [String] Gets or sets the preferred language - # for the response. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def put_async_relative_retry_succeeded(product = nil, custom_headers = nil) - # Send request - promise = begin_put_async_relative_retry_succeeded(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_put_operation_result(response, custom_headers, deserialize_method) - end - - promise - end - - # - # Long running put request, service returns a 500, then a 200 to the initial - # request, with an entity that contains ProvisioningState=’Creating’. Poll - # the endpoint indicated in the Azure-AsyncOperation header for operation - # status - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_put_async_relative_retry_succeeded(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/retryerror/putasync/retry/succeeded" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running delete request, service returns a 500, then a 202 to the - # initial request, with an entity that contains ProvisioningState=’Accepted’. - # Polls return this value until the last poll returns a ‘200’ with - # ProvisioningState=’Succeeded’ - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def delete_provisioning202accepted200succeeded(custom_headers = nil) - # Send request - promise = begin_delete_provisioning202accepted200succeeded(custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running delete request, service returns a 500, then a 202 to the - # initial request, with an entity that contains ProvisioningState=’Accepted’. - # Polls return this value until the last poll returns a ‘200’ with - # ProvisioningState=’Succeeded’ - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_delete_provisioning202accepted200succeeded(custom_headers = nil) - # Construct URL - path = "/lro/retryerror/delete/provisioning/202/accepted/200/succeeded" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - # Deserialize Response - if status_code == 202 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running delete request, service returns a 500, then a 202 to the - # initial request. Polls return this value until the last poll returns a - # ‘200’ with ProvisioningState=’Succeeded’ - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def delete202retry200(custom_headers = nil) - # Send request - promise = begin_delete202retry200(custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running delete request, service returns a 500, then a 202 to the - # initial request. Polls return this value until the last poll returns a - # ‘200’ with ProvisioningState=’Succeeded’ - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_delete202retry200(custom_headers = nil) - # Construct URL - path = "/lro/retryerror/delete/202/retry/200" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Long running delete request, service returns a 500, then a 202 to the - # initial request. Poll the endpoint indicated in the Azure-AsyncOperation - # header for operation status - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def delete_async_relative_retry_succeeded(custom_headers = nil) - # Send request - promise = begin_delete_async_relative_retry_succeeded(custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running delete request, service returns a 500, then a 202 to the - # initial request. Poll the endpoint indicated in the Azure-AsyncOperation - # header for operation status - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_delete_async_relative_retry_succeeded(custom_headers = nil) - # Construct URL - path = "/lro/retryerror/deleteasync/retry/succeeded" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Long running post request, service returns a 500, then a 202 to the initial - # request, with 'Location' and 'Retry-After' headers, Polls return a 200 with - # a response body after success - # - # @param product [Product] Product to put - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def post202retry200(product = nil, custom_headers = nil) - # Send request - promise = begin_post202retry200(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running post request, service returns a 500, then a 202 to the initial - # request, with 'Location' and 'Retry-After' headers, Polls return a 200 with - # a response body after success - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_post202retry200(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/retryerror/post/202/retry/200" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Long running post request, service returns a 500, then a 202 to the initial - # request, with an entity that contains ProvisioningState=’Creating’. Poll - # the endpoint indicated in the Azure-AsyncOperation header for operation - # status - # - # @param product [Product] Product to put - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def post_async_relative_retry_succeeded(product = nil, custom_headers = nil) - # Send request - promise = begin_post_async_relative_retry_succeeded(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running post request, service returns a 500, then a 202 to the initial - # request, with an entity that contains ProvisioningState=’Creating’. Poll - # the endpoint indicated in the Azure-AsyncOperation header for operation - # status - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_post_async_relative_retry_succeeded(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/retryerror/postasync/retry/succeeded" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/lros.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/lros.rb deleted file mode 100644 index 4023ee627..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/lros.rb +++ /dev/null @@ -1,4196 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module LroModule - # - # Long-running Operation for AutoRest - # - class LROs - include LroModule::Models - include MsRestAzure - - # - # Creates and initializes a new instance of the LROs class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestLongRunningOperationTestService - attr_reader :client - - # - # Long running put request, service returns a 200 to the initial request, with - # an entity that contains ProvisioningState=’Succeeded’. - # - # @param product [Product] Product to put - # @param @client.accept_language [String] Gets or sets the preferred language - # for the response. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def put200succeeded(product = nil, custom_headers = nil) - # Send request - promise = begin_put200succeeded(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_put_operation_result(response, custom_headers, deserialize_method) - end - - promise - end - - # - # Long running put request, service returns a 200 to the initial request, with - # an entity that contains ProvisioningState=’Succeeded’. - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_put200succeeded(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/put/200/succeeded" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 204) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running put request, service returns a 200 to the initial request, with - # an entity that does not contain ProvisioningState=’Succeeded’. - # - # @param product [Product] Product to put - # @param @client.accept_language [String] Gets or sets the preferred language - # for the response. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def put200succeeded_no_state(product = nil, custom_headers = nil) - # Send request - promise = begin_put200succeeded_no_state(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_put_operation_result(response, custom_headers, deserialize_method) - end - - promise - end - - # - # Long running put request, service returns a 200 to the initial request, with - # an entity that does not contain ProvisioningState=’Succeeded’. - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_put200succeeded_no_state(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/put/200/succeeded/nostate" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running put request, service returns a 202 to the initial request, with - # a location header that points to a polling URL that returns a 200 and an - # entity that doesn't contains ProvisioningState - # - # @param product [Product] Product to put - # @param @client.accept_language [String] Gets or sets the preferred language - # for the response. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def put202retry200(product = nil, custom_headers = nil) - # Send request - promise = begin_put202retry200(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_put_operation_result(response, custom_headers, deserialize_method) - end - - promise - end - - # - # Long running put request, service returns a 202 to the initial request, with - # a location header that points to a polling URL that returns a 200 and an - # entity that doesn't contains ProvisioningState - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_put202retry200(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/put/202/retry/200" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 202 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running put request, service returns a 201 to the initial request, with - # an entity that contains ProvisioningState=’Creating’. Polls return this - # value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’ - # - # @param product [Product] Product to put - # @param @client.accept_language [String] Gets or sets the preferred language - # for the response. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def put201creating_succeeded200(product = nil, custom_headers = nil) - # Send request - promise = begin_put201creating_succeeded200(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_put_operation_result(response, custom_headers, deserialize_method) - end - - promise - end - - # - # Long running put request, service returns a 201 to the initial request, with - # an entity that contains ProvisioningState=’Creating’. Polls return this - # value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’ - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_put201creating_succeeded200(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/put/201/creating/succeeded/200" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 201) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - # Deserialize Response - if status_code == 201 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running put request, service returns a 201 to the initial request, with - # an entity that contains ProvisioningState=’Updating’. Polls return this - # value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’ - # - # @param product [Product] Product to put - # @param @client.accept_language [String] Gets or sets the preferred language - # for the response. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def put200updating_succeeded204(product = nil, custom_headers = nil) - # Send request - promise = begin_put200updating_succeeded204(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_put_operation_result(response, custom_headers, deserialize_method) - end - - promise - end - - # - # Long running put request, service returns a 201 to the initial request, with - # an entity that contains ProvisioningState=’Updating’. Polls return this - # value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’ - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_put200updating_succeeded204(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/put/200/updating/succeeded/200" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running put request, service returns a 201 to the initial request, with - # an entity that contains ProvisioningState=’Created’. Polls return this - # value until the last poll returns a ‘200’ with ProvisioningState=’Failed’ - # - # @param product [Product] Product to put - # @param @client.accept_language [String] Gets or sets the preferred language - # for the response. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def put201creating_failed200(product = nil, custom_headers = nil) - # Send request - promise = begin_put201creating_failed200(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_put_operation_result(response, custom_headers, deserialize_method) - end - - promise - end - - # - # Long running put request, service returns a 201 to the initial request, with - # an entity that contains ProvisioningState=’Created’. Polls return this - # value until the last poll returns a ‘200’ with ProvisioningState=’Failed’ - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_put201creating_failed200(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/put/201/created/failed/200" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 201) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - # Deserialize Response - if status_code == 201 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running put request, service returns a 201 to the initial request, with - # an entity that contains ProvisioningState=’Creating’. Polls return this - # value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’ - # - # @param product [Product] Product to put - # @param @client.accept_language [String] Gets or sets the preferred language - # for the response. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def put200acceptedcanceled200(product = nil, custom_headers = nil) - # Send request - promise = begin_put200acceptedcanceled200(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_put_operation_result(response, custom_headers, deserialize_method) - end - - promise - end - - # - # Long running put request, service returns a 201 to the initial request, with - # an entity that contains ProvisioningState=’Creating’. Polls return this - # value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’ - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_put200acceptedcanceled200(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/put/200/accepted/canceled/200" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running put request, service returns a 202 to the initial request with - # location header. Subsequent calls to operation status do not contain - # location header. - # - # @param product [Product] Product to put - # @param @client.accept_language [String] Gets or sets the preferred language - # for the response. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def put_no_header_in_retry(product = nil, custom_headers = nil) - # Send request - promise = begin_put_no_header_in_retry(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_put_operation_result(response, custom_headers, deserialize_method) - end - - promise - end - - # - # Long running put request, service returns a 202 to the initial request with - # location header. Subsequent calls to operation status do not contain - # location header. - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_put_no_header_in_retry(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/put/noheader/202/200" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 202 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running put request, service returns a 200 to the initial request, with - # an entity that contains ProvisioningState=’Creating’. Poll the endpoint - # indicated in the Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @param @client.accept_language [String] Gets or sets the preferred language - # for the response. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def put_async_retry_succeeded(product = nil, custom_headers = nil) - # Send request - promise = begin_put_async_retry_succeeded(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_put_operation_result(response, custom_headers, deserialize_method) - end - - promise - end - - # - # Long running put request, service returns a 200 to the initial request, with - # an entity that contains ProvisioningState=’Creating’. Poll the endpoint - # indicated in the Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_put_async_retry_succeeded(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/putasync/retry/succeeded" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running put request, service returns a 200 to the initial request, with - # an entity that contains ProvisioningState=’Creating’. Poll the endpoint - # indicated in the Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @param @client.accept_language [String] Gets or sets the preferred language - # for the response. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def put_async_no_retry_succeeded(product = nil, custom_headers = nil) - # Send request - promise = begin_put_async_no_retry_succeeded(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_put_operation_result(response, custom_headers, deserialize_method) - end - - promise - end - - # - # Long running put request, service returns a 200 to the initial request, with - # an entity that contains ProvisioningState=’Creating’. Poll the endpoint - # indicated in the Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_put_async_no_retry_succeeded(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/putasync/noretry/succeeded" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running put request, service returns a 200 to the initial request, with - # an entity that contains ProvisioningState=’Creating’. Poll the endpoint - # indicated in the Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @param @client.accept_language [String] Gets or sets the preferred language - # for the response. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def put_async_retry_failed(product = nil, custom_headers = nil) - # Send request - promise = begin_put_async_retry_failed(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_put_operation_result(response, custom_headers, deserialize_method) - end - - promise - end - - # - # Long running put request, service returns a 200 to the initial request, with - # an entity that contains ProvisioningState=’Creating’. Poll the endpoint - # indicated in the Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_put_async_retry_failed(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/putasync/retry/failed" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running put request, service returns a 200 to the initial request, with - # an entity that contains ProvisioningState=’Creating’. Poll the endpoint - # indicated in the Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @param @client.accept_language [String] Gets or sets the preferred language - # for the response. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def put_async_no_retrycanceled(product = nil, custom_headers = nil) - # Send request - promise = begin_put_async_no_retrycanceled(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_put_operation_result(response, custom_headers, deserialize_method) - end - - promise - end - - # - # Long running put request, service returns a 200 to the initial request, with - # an entity that contains ProvisioningState=’Creating’. Poll the endpoint - # indicated in the Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_put_async_no_retrycanceled(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/putasync/noretry/canceled" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running put request, service returns a 202 to the initial request with - # Azure-AsyncOperation header. Subsequent calls to operation status do not - # contain Azure-AsyncOperation header. - # - # @param product [Product] Product to put - # @param @client.accept_language [String] Gets or sets the preferred language - # for the response. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def put_async_no_header_in_retry(product = nil, custom_headers = nil) - # Send request - promise = begin_put_async_no_header_in_retry(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_put_operation_result(response, custom_headers, deserialize_method) - end - - promise - end - - # - # Long running put request, service returns a 202 to the initial request with - # Azure-AsyncOperation header. Subsequent calls to operation status do not - # contain Azure-AsyncOperation header. - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_put_async_no_header_in_retry(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/putasync/noheader/201/200" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 201) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 201 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running put request with non resource. - # - # @param sku [Sku] sku to put - # @param @client.accept_language [String] Gets or sets the preferred language - # for the response. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def put_non_resource(sku = nil, custom_headers = nil) - # Send request - promise = begin_put_non_resource(sku, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Sku.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_put_operation_result(response, custom_headers, deserialize_method) - end - - promise - end - - # - # Long running put request with non resource. - # - # @param sku [Sku] sku to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_put_non_resource(sku = nil, custom_headers = nil) - sku.validate unless sku.nil? - # Construct URL - path = "/lro/putnonresource/202/200" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless sku.nil? - sku = Sku.serialize_object(sku) - end - request_content = JSON.generate(sku, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 202 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Sku.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running put request with non resource. - # - # @param sku [Sku] Sku to put - # @param @client.accept_language [String] Gets or sets the preferred language - # for the response. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def put_async_non_resource(sku = nil, custom_headers = nil) - # Send request - promise = begin_put_async_non_resource(sku, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Sku.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_put_operation_result(response, custom_headers, deserialize_method) - end - - promise - end - - # - # Long running put request with non resource. - # - # @param sku [Sku] Sku to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_put_async_non_resource(sku = nil, custom_headers = nil) - sku.validate unless sku.nil? - # Construct URL - path = "/lro/putnonresourceasync/202/200" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless sku.nil? - sku = Sku.serialize_object(sku) - end - request_content = JSON.generate(sku, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 202 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Sku.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running put request with sub resource. - # - # @param product [SubProduct] Sub Product to put - # @param @client.accept_language [String] Gets or sets the preferred language - # for the response. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def put_sub_resource(product = nil, custom_headers = nil) - # Send request - promise = begin_put_sub_resource(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = SubProduct.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_put_operation_result(response, custom_headers, deserialize_method) - end - - promise - end - - # - # Long running put request with sub resource. - # - # @param product [SubProduct] Sub Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_put_sub_resource(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/putsubresource/202/200" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = SubProduct.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 202 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = SubProduct.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running put request with sub resource. - # - # @param product [SubProduct] Sub Product to put - # @param @client.accept_language [String] Gets or sets the preferred language - # for the response. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def put_async_sub_resource(product = nil, custom_headers = nil) - # Send request - promise = begin_put_async_sub_resource(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = SubProduct.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_put_operation_result(response, custom_headers, deserialize_method) - end - - promise - end - - # - # Long running put request with sub resource. - # - # @param product [SubProduct] Sub Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_put_async_sub_resource(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/putsubresourceasync/202/200" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = SubProduct.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 202 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = SubProduct.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running delete request, service returns a 202 to the initial request, - # with an entity that contains ProvisioningState=’Accepted’. Polls return - # this value until the last poll returns a ‘200’ with - # ProvisioningState=’Succeeded’ - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def delete_provisioning202accepted200succeeded(custom_headers = nil) - # Send request - promise = begin_delete_provisioning202accepted200succeeded(custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running delete request, service returns a 202 to the initial request, - # with an entity that contains ProvisioningState=’Accepted’. Polls return - # this value until the last poll returns a ‘200’ with - # ProvisioningState=’Succeeded’ - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_delete_provisioning202accepted200succeeded(custom_headers = nil) - # Construct URL - path = "/lro/delete/provisioning/202/accepted/200/succeeded" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - # Deserialize Response - if status_code == 202 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running delete request, service returns a 202 to the initial request, - # with an entity that contains ProvisioningState=’Creating’. Polls return - # this value until the last poll returns a ‘200’ with - # ProvisioningState=’Failed’ - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def delete_provisioning202deleting_failed200(custom_headers = nil) - # Send request - promise = begin_delete_provisioning202deleting_failed200(custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running delete request, service returns a 202 to the initial request, - # with an entity that contains ProvisioningState=’Creating’. Polls return - # this value until the last poll returns a ‘200’ with - # ProvisioningState=’Failed’ - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_delete_provisioning202deleting_failed200(custom_headers = nil) - # Construct URL - path = "/lro/delete/provisioning/202/deleting/200/failed" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - # Deserialize Response - if status_code == 202 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running delete request, service returns a 202 to the initial request, - # with an entity that contains ProvisioningState=’Creating’. Polls return - # this value until the last poll returns a ‘200’ with - # ProvisioningState=’Canceled’ - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def delete_provisioning202deletingcanceled200(custom_headers = nil) - # Send request - promise = begin_delete_provisioning202deletingcanceled200(custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running delete request, service returns a 202 to the initial request, - # with an entity that contains ProvisioningState=’Creating’. Polls return - # this value until the last poll returns a ‘200’ with - # ProvisioningState=’Canceled’ - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_delete_provisioning202deletingcanceled200(custom_headers = nil) - # Construct URL - path = "/lro/delete/provisioning/202/deleting/200/canceled" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - # Deserialize Response - if status_code == 202 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running delete succeeds and returns right away - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def delete204succeeded(custom_headers = nil) - # Send request - promise = begin_delete204succeeded(custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running delete succeeds and returns right away - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_delete204succeeded(custom_headers = nil) - # Construct URL - path = "/lro/delete/204/succeeded" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 204) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Long running delete request, service returns a 202 to the initial request. - # Polls return this value until the last poll returns a ‘200’ with - # ProvisioningState=’Succeeded’ - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def delete202retry200(custom_headers = nil) - # Send request - promise = begin_delete202retry200(custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running delete request, service returns a 202 to the initial request. - # Polls return this value until the last poll returns a ‘200’ with - # ProvisioningState=’Succeeded’ - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_delete202retry200(custom_headers = nil) - # Construct URL - path = "/lro/delete/202/retry/200" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running delete request, service returns a 202 to the initial request. - # Polls return this value until the last poll returns a ‘200’ with - # ProvisioningState=’Succeeded’ - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def delete202no_retry204(custom_headers = nil) - # Send request - promise = begin_delete202no_retry204(custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running delete request, service returns a 202 to the initial request. - # Polls return this value until the last poll returns a ‘200’ with - # ProvisioningState=’Succeeded’ - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_delete202no_retry204(custom_headers = nil) - # Construct URL - path = "/lro/delete/202/noretry/204" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running delete request, service returns a location header in the - # initial request. Subsequent calls to operation status do not contain - # location header. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def delete_no_header_in_retry(custom_headers = nil) - # Send request - promise = begin_delete_no_header_in_retry(custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running delete request, service returns a location header in the - # initial request. Subsequent calls to operation status do not contain - # location header. - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_delete_no_header_in_retry(custom_headers = nil) - # Construct URL - path = "/lro/delete/noheader" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 204 || status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Long running delete request, service returns an Azure-AsyncOperation header - # in the initial request. Subsequent calls to operation status do not contain - # Azure-AsyncOperation header. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def delete_async_no_header_in_retry(custom_headers = nil) - # Send request - promise = begin_delete_async_no_header_in_retry(custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running delete request, service returns an Azure-AsyncOperation header - # in the initial request. Subsequent calls to operation status do not contain - # Azure-AsyncOperation header. - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_delete_async_no_header_in_retry(custom_headers = nil) - # Construct URL - path = "/lro/deleteasync/noheader/202/204" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 204 || status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Long running delete request, service returns a 202 to the initial request. - # Poll the endpoint indicated in the Azure-AsyncOperation header for - # operation status - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def delete_async_retry_succeeded(custom_headers = nil) - # Send request - promise = begin_delete_async_retry_succeeded(custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running delete request, service returns a 202 to the initial request. - # Poll the endpoint indicated in the Azure-AsyncOperation header for - # operation status - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_delete_async_retry_succeeded(custom_headers = nil) - # Construct URL - path = "/lro/deleteasync/retry/succeeded" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Long running delete request, service returns a 202 to the initial request. - # Poll the endpoint indicated in the Azure-AsyncOperation header for - # operation status - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def delete_async_no_retry_succeeded(custom_headers = nil) - # Send request - promise = begin_delete_async_no_retry_succeeded(custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running delete request, service returns a 202 to the initial request. - # Poll the endpoint indicated in the Azure-AsyncOperation header for - # operation status - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_delete_async_no_retry_succeeded(custom_headers = nil) - # Construct URL - path = "/lro/deleteasync/noretry/succeeded" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Long running delete request, service returns a 202 to the initial request. - # Poll the endpoint indicated in the Azure-AsyncOperation header for - # operation status - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def delete_async_retry_failed(custom_headers = nil) - # Send request - promise = begin_delete_async_retry_failed(custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running delete request, service returns a 202 to the initial request. - # Poll the endpoint indicated in the Azure-AsyncOperation header for - # operation status - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_delete_async_retry_failed(custom_headers = nil) - # Construct URL - path = "/lro/deleteasync/retry/failed" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Long running delete request, service returns a 202 to the initial request. - # Poll the endpoint indicated in the Azure-AsyncOperation header for - # operation status - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def delete_async_retrycanceled(custom_headers = nil) - # Send request - promise = begin_delete_async_retrycanceled(custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running delete request, service returns a 202 to the initial request. - # Poll the endpoint indicated in the Azure-AsyncOperation header for - # operation status - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_delete_async_retrycanceled(custom_headers = nil) - # Construct URL - path = "/lro/deleteasync/retry/canceled" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Long running post request, service returns a 202 to the initial request, - # with 'Location' header. Poll returns a 200 with a response body after - # success. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def post200with_payload(custom_headers = nil) - # Send request - promise = begin_post200with_payload(custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Sku.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running post request, service returns a 202 to the initial request, - # with 'Location' header. Poll returns a 200 with a response body after - # success. - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_post200with_payload(custom_headers = nil) - # Construct URL - path = "/lro/post/payload/200" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202 || status_code == 200) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 202 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Sku.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Sku.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running post request, service returns a 202 to the initial request, - # with 'Location' and 'Retry-After' headers, Polls return a 200 with a - # response body after success - # - # @param product [Product] Product to put - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def post202retry200(product = nil, custom_headers = nil) - # Send request - promise = begin_post202retry200(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running post request, service returns a 202 to the initial request, - # with 'Location' and 'Retry-After' headers, Polls return a 200 with a - # response body after success - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_post202retry200(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/post/202/retry/200" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Long running post request, service returns a 202 to the initial request, - # with 'Location' header, 204 with noresponse body after success - # - # @param product [Product] Product to put - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def post202no_retry204(product = nil, custom_headers = nil) - # Send request - promise = begin_post202no_retry204(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running post request, service returns a 202 to the initial request, - # with 'Location' header, 204 with noresponse body after success - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_post202no_retry204(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/post/202/noretry/204" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 202 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running post request, service returns a 202 to the initial request, - # with an entity that contains ProvisioningState=’Creating’. Poll the - # endpoint indicated in the Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def post_async_retry_succeeded(product = nil, custom_headers = nil) - # Send request - promise = begin_post_async_retry_succeeded(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running post request, service returns a 202 to the initial request, - # with an entity that contains ProvisioningState=’Creating’. Poll the - # endpoint indicated in the Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_post_async_retry_succeeded(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/postasync/retry/succeeded" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202 || status_code == 200) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running post request, service returns a 202 to the initial request, - # with an entity that contains ProvisioningState=’Creating’. Poll the - # endpoint indicated in the Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def post_async_no_retry_succeeded(product = nil, custom_headers = nil) - # Send request - promise = begin_post_async_no_retry_succeeded(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running post request, service returns a 202 to the initial request, - # with an entity that contains ProvisioningState=’Creating’. Poll the - # endpoint indicated in the Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_post_async_no_retry_succeeded(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/postasync/noretry/succeeded" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202 || status_code == 200) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running post request, service returns a 202 to the initial request, - # with an entity that contains ProvisioningState=’Creating’. Poll the - # endpoint indicated in the Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def post_async_retry_failed(product = nil, custom_headers = nil) - # Send request - promise = begin_post_async_retry_failed(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running post request, service returns a 202 to the initial request, - # with an entity that contains ProvisioningState=’Creating’. Poll the - # endpoint indicated in the Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_post_async_retry_failed(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/postasync/retry/failed" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Long running post request, service returns a 202 to the initial request, - # with an entity that contains ProvisioningState=’Creating’. Poll the - # endpoint indicated in the Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def post_async_retrycanceled(product = nil, custom_headers = nil) - # Send request - promise = begin_post_async_retrycanceled(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running post request, service returns a 202 to the initial request, - # with an entity that contains ProvisioningState=’Creating’. Poll the - # endpoint indicated in the Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_post_async_retrycanceled(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/postasync/retry/canceled" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/lros_custom_header.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/lros_custom_header.rb deleted file mode 100644 index 8da0449dd..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/lros_custom_header.rb +++ /dev/null @@ -1,516 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module LroModule - # - # Long-running Operation for AutoRest - # - class LROsCustomHeader - include LroModule::Models - include MsRestAzure - - # - # Creates and initializes a new instance of the LROsCustomHeader class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestLongRunningOperationTestService - attr_reader :client - - # - # x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required - # message header for all requests. Long running put request, service returns - # a 200 to the initial request, with an entity that contains - # ProvisioningState=’Creating’. Poll the endpoint indicated in the - # Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @param @client.accept_language [String] Gets or sets the preferred language - # for the response. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def put_async_retry_succeeded(product = nil, custom_headers = nil) - # Send request - promise = begin_put_async_retry_succeeded(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_put_operation_result(response, custom_headers, deserialize_method) - end - - promise - end - - # - # x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required - # message header for all requests. Long running put request, service returns - # a 200 to the initial request, with an entity that contains - # ProvisioningState=’Creating’. Poll the endpoint indicated in the - # Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_put_async_retry_succeeded(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/customheader/putasync/retry/succeeded" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required - # message header for all requests. Long running put request, service returns - # a 201 to the initial request, with an entity that contains - # ProvisioningState=’Creating’. Polls return this value until the last poll - # returns a ‘200’ with ProvisioningState=’Succeeded’ - # - # @param product [Product] Product to put - # @param @client.accept_language [String] Gets or sets the preferred language - # for the response. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def put201creating_succeeded200(product = nil, custom_headers = nil) - # Send request - promise = begin_put201creating_succeeded200(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_put_operation_result(response, custom_headers, deserialize_method) - end - - promise - end - - # - # x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required - # message header for all requests. Long running put request, service returns - # a 201 to the initial request, with an entity that contains - # ProvisioningState=’Creating’. Polls return this value until the last poll - # returns a ‘200’ with ProvisioningState=’Succeeded’ - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_put201creating_succeeded200(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/customheader/put/201/creating/succeeded/200" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 201) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - # Deserialize Response - if status_code == 201 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required - # message header for all requests. Long running post request, service returns - # a 202 to the initial request, with 'Location' and 'Retry-After' headers, - # Polls return a 200 with a response body after success - # - # @param product [Product] Product to put - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def post202retry200(product = nil, custom_headers = nil) - # Send request - promise = begin_post202retry200(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required - # message header for all requests. Long running post request, service returns - # a 202 to the initial request, with 'Location' and 'Retry-After' headers, - # Polls return a 200 with a response body after success - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_post202retry200(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/customheader/post/202/retry/200" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required - # message header for all requests. Long running post request, service returns - # a 202 to the initial request, with an entity that contains - # ProvisioningState=’Creating’. Poll the endpoint indicated in the - # Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def post_async_retry_succeeded(product = nil, custom_headers = nil) - # Send request - promise = begin_post_async_retry_succeeded(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required - # message header for all requests. Long running post request, service returns - # a 202 to the initial request, with an entity that contains - # ProvisioningState=’Creating’. Poll the endpoint indicated in the - # Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_post_async_retry_succeeded(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/customheader/postasync/retry/succeeded" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/lrosads.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/lrosads.rb deleted file mode 100644 index b5307c1da..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/lrosads.rb +++ /dev/null @@ -1,2754 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module LroModule - # - # Long-running Operation for AutoRest - # - class LROSADs - include LroModule::Models - include MsRestAzure - - # - # Creates and initializes a new instance of the LROSADs class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestLongRunningOperationTestService - attr_reader :client - - # - # Long running put request, service returns a 400 to the initial request - # - # @param product [Product] Product to put - # @param @client.accept_language [String] Gets or sets the preferred language - # for the response. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def put_non_retry400(product = nil, custom_headers = nil) - # Send request - promise = begin_put_non_retry400(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_put_operation_result(response, custom_headers, deserialize_method) - end - - promise - end - - # - # Long running put request, service returns a 400 to the initial request - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_put_non_retry400(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/nonretryerror/put/400" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 201) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - # Deserialize Response - if status_code == 201 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running put request, service returns a Product with 'ProvisioningState' - # = 'Creating' and 201 response code - # - # @param product [Product] Product to put - # @param @client.accept_language [String] Gets or sets the preferred language - # for the response. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def put_non_retry201creating400(product = nil, custom_headers = nil) - # Send request - promise = begin_put_non_retry201creating400(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_put_operation_result(response, custom_headers, deserialize_method) - end - - promise - end - - # - # Long running put request, service returns a Product with 'ProvisioningState' - # = 'Creating' and 201 response code - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_put_non_retry201creating400(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/nonretryerror/put/201/creating/400" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 201) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - # Deserialize Response - if status_code == 201 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running put request, service returns a 200 with - # ProvisioningState=’Creating’. Poll the endpoint indicated in the - # Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @param @client.accept_language [String] Gets or sets the preferred language - # for the response. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def put_async_relative_retry400(product = nil, custom_headers = nil) - # Send request - promise = begin_put_async_relative_retry400(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_put_operation_result(response, custom_headers, deserialize_method) - end - - promise - end - - # - # Long running put request, service returns a 200 with - # ProvisioningState=’Creating’. Poll the endpoint indicated in the - # Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_put_async_relative_retry400(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/nonretryerror/putasync/retry/400" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running delete request, service returns a 400 with an error body - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def delete_non_retry400(custom_headers = nil) - # Send request - promise = begin_delete_non_retry400(custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running delete request, service returns a 400 with an error body - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_delete_non_retry400(custom_headers = nil) - # Construct URL - path = "/lro/nonretryerror/delete/400" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Long running delete request, service returns a 202 with a location header - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def delete202non_retry400(custom_headers = nil) - # Send request - promise = begin_delete202non_retry400(custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running delete request, service returns a 202 with a location header - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_delete202non_retry400(custom_headers = nil) - # Construct URL - path = "/lro/nonretryerror/delete/202/retry/400" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Long running delete request, service returns a 202 to the initial request. - # Poll the endpoint indicated in the Azure-AsyncOperation header for - # operation status - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def delete_async_relative_retry400(custom_headers = nil) - # Send request - promise = begin_delete_async_relative_retry400(custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running delete request, service returns a 202 to the initial request. - # Poll the endpoint indicated in the Azure-AsyncOperation header for - # operation status - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_delete_async_relative_retry400(custom_headers = nil) - # Construct URL - path = "/lro/nonretryerror/deleteasync/retry/400" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Long running post request, service returns a 400 with no error body - # - # @param product [Product] Product to put - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def post_non_retry400(product = nil, custom_headers = nil) - # Send request - promise = begin_post_non_retry400(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running post request, service returns a 400 with no error body - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_post_non_retry400(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/nonretryerror/post/400" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Long running post request, service returns a 202 with a location header - # - # @param product [Product] Product to put - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def post202non_retry400(product = nil, custom_headers = nil) - # Send request - promise = begin_post202non_retry400(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running post request, service returns a 202 with a location header - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_post202non_retry400(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/nonretryerror/post/202/retry/400" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Long running post request, service returns a 202 to the initial request Poll - # the endpoint indicated in the Azure-AsyncOperation header for operation - # status - # - # @param product [Product] Product to put - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def post_async_relative_retry400(product = nil, custom_headers = nil) - # Send request - promise = begin_post_async_relative_retry400(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running post request, service returns a 202 to the initial request Poll - # the endpoint indicated in the Azure-AsyncOperation header for operation - # status - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_post_async_relative_retry400(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/nonretryerror/postasync/retry/400" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Long running put request, service returns a 201 to the initial request with - # no payload - # - # @param product [Product] Product to put - # @param @client.accept_language [String] Gets or sets the preferred language - # for the response. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def put_error201no_provisioning_state_payload(product = nil, custom_headers = nil) - # Send request - promise = begin_put_error201no_provisioning_state_payload(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_put_operation_result(response, custom_headers, deserialize_method) - end - - promise - end - - # - # Long running put request, service returns a 201 to the initial request with - # no payload - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_put_error201no_provisioning_state_payload(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/error/put/201/noprovisioningstatepayload" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 201) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - # Deserialize Response - if status_code == 201 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running put request, service returns a 200 to the initial request, with - # an entity that contains ProvisioningState=’Creating’. Poll the endpoint - # indicated in the Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @param @client.accept_language [String] Gets or sets the preferred language - # for the response. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def put_async_relative_retry_no_status(product = nil, custom_headers = nil) - # Send request - promise = begin_put_async_relative_retry_no_status(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_put_operation_result(response, custom_headers, deserialize_method) - end - - promise - end - - # - # Long running put request, service returns a 200 to the initial request, with - # an entity that contains ProvisioningState=’Creating’. Poll the endpoint - # indicated in the Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_put_async_relative_retry_no_status(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/error/putasync/retry/nostatus" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running put request, service returns a 200 to the initial request, with - # an entity that contains ProvisioningState=’Creating’. Poll the endpoint - # indicated in the Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @param @client.accept_language [String] Gets or sets the preferred language - # for the response. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def put_async_relative_retry_no_status_payload(product = nil, custom_headers = nil) - # Send request - promise = begin_put_async_relative_retry_no_status_payload(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_put_operation_result(response, custom_headers, deserialize_method) - end - - promise - end - - # - # Long running put request, service returns a 200 to the initial request, with - # an entity that contains ProvisioningState=’Creating’. Poll the endpoint - # indicated in the Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_put_async_relative_retry_no_status_payload(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/error/putasync/retry/nostatuspayload" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running delete request, service returns a 204 to the initial request, - # indicating success. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def delete204succeeded(custom_headers = nil) - # Send request - promise = begin_delete204succeeded(custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running delete request, service returns a 204 to the initial request, - # indicating success. - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_delete204succeeded(custom_headers = nil) - # Construct URL - path = "/lro/error/delete/204/nolocation" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 204) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Long running delete request, service returns a 202 to the initial request. - # Poll the endpoint indicated in the Azure-AsyncOperation header for - # operation status - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def delete_async_relative_retry_no_status(custom_headers = nil) - # Send request - promise = begin_delete_async_relative_retry_no_status(custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running delete request, service returns a 202 to the initial request. - # Poll the endpoint indicated in the Azure-AsyncOperation header for - # operation status - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_delete_async_relative_retry_no_status(custom_headers = nil) - # Construct URL - path = "/lro/error/deleteasync/retry/nostatus" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Long running post request, service returns a 202 to the initial request, - # without a location header. - # - # @param product [Product] Product to put - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def post202no_location(product = nil, custom_headers = nil) - # Send request - promise = begin_post202no_location(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running post request, service returns a 202 to the initial request, - # without a location header. - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_post202no_location(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/error/post/202/nolocation" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Long running post request, service returns a 202 to the initial request, - # with an entity that contains ProvisioningState=’Creating’. Poll the - # endpoint indicated in the Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def post_async_relative_retry_no_payload(product = nil, custom_headers = nil) - # Send request - promise = begin_post_async_relative_retry_no_payload(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running post request, service returns a 202 to the initial request, - # with an entity that contains ProvisioningState=’Creating’. Poll the - # endpoint indicated in the Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_post_async_relative_retry_no_payload(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/error/postasync/retry/nopayload" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Long running put request, service returns a 200 to the initial request, with - # an entity that is not a valid json - # - # @param product [Product] Product to put - # @param @client.accept_language [String] Gets or sets the preferred language - # for the response. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def put200invalid_json(product = nil, custom_headers = nil) - # Send request - promise = begin_put200invalid_json(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_put_operation_result(response, custom_headers, deserialize_method) - end - - promise - end - - # - # Long running put request, service returns a 200 to the initial request, with - # an entity that is not a valid json - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_put200invalid_json(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/error/put/200/invalidjson" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 204) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running put request, service returns a 200 to the initial request, with - # an entity that contains ProvisioningState=’Creating’. The endpoint - # indicated in the Azure-AsyncOperation header is invalid. - # - # @param product [Product] Product to put - # @param @client.accept_language [String] Gets or sets the preferred language - # for the response. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def put_async_relative_retry_invalid_header(product = nil, custom_headers = nil) - # Send request - promise = begin_put_async_relative_retry_invalid_header(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_put_operation_result(response, custom_headers, deserialize_method) - end - - promise - end - - # - # Long running put request, service returns a 200 to the initial request, with - # an entity that contains ProvisioningState=’Creating’. The endpoint - # indicated in the Azure-AsyncOperation header is invalid. - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_put_async_relative_retry_invalid_header(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/error/putasync/retry/invalidheader" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running put request, service returns a 200 to the initial request, with - # an entity that contains ProvisioningState=’Creating’. Poll the endpoint - # indicated in the Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @param @client.accept_language [String] Gets or sets the preferred language - # for the response. - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def put_async_relative_retry_invalid_json_polling(product = nil, custom_headers = nil) - # Send request - promise = begin_put_async_relative_retry_invalid_json_polling(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - end - - # Waiting for response. - @client.get_put_operation_result(response, custom_headers, deserialize_method) - end - - promise - end - - # - # Long running put request, service returns a 200 to the initial request, with - # an entity that contains ProvisioningState=’Creating’. Poll the endpoint - # indicated in the Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_put_async_relative_retry_invalid_json_polling(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/error/putasync/retry/invalidjsonpolling" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Product.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Long running delete request, service returns a 202 to the initial request - # receing a reponse with an invalid 'Location' and 'Retry-After' headers - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def delete202retry_invalid_header(custom_headers = nil) - # Send request - promise = begin_delete202retry_invalid_header(custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running delete request, service returns a 202 to the initial request - # receing a reponse with an invalid 'Location' and 'Retry-After' headers - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_delete202retry_invalid_header(custom_headers = nil) - # Construct URL - path = "/lro/error/delete/202/retry/invalidheader" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Long running delete request, service returns a 202 to the initial request. - # The endpoint indicated in the Azure-AsyncOperation header is invalid - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def delete_async_relative_retry_invalid_header(custom_headers = nil) - # Send request - promise = begin_delete_async_relative_retry_invalid_header(custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running delete request, service returns a 202 to the initial request. - # The endpoint indicated in the Azure-AsyncOperation header is invalid - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_delete_async_relative_retry_invalid_header(custom_headers = nil) - # Construct URL - path = "/lro/error/deleteasync/retry/invalidheader" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Long running delete request, service returns a 202 to the initial request. - # Poll the endpoint indicated in the Azure-AsyncOperation header for - # operation status - # - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def delete_async_relative_retry_invalid_json_polling(custom_headers = nil) - # Send request - promise = begin_delete_async_relative_retry_invalid_json_polling(custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running delete request, service returns a 202 to the initial request. - # Poll the endpoint indicated in the Azure-AsyncOperation header for - # operation status - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_delete_async_relative_retry_invalid_json_polling(custom_headers = nil) - # Construct URL - path = "/lro/error/deleteasync/retry/invalidjsonpolling" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Long running post request, service returns a 202 to the initial request, - # with invalid 'Location' and 'Retry-After' headers. - # - # @param product [Product] Product to put - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def post202retry_invalid_header(product = nil, custom_headers = nil) - # Send request - promise = begin_post202retry_invalid_header(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running post request, service returns a 202 to the initial request, - # with invalid 'Location' and 'Retry-After' headers. - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_post202retry_invalid_header(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/error/post/202/retry/invalidheader" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Long running post request, service returns a 202 to the initial request, - # with an entity that contains ProvisioningState=’Creating’. The endpoint - # indicated in the Azure-AsyncOperation header is invalid. - # - # @param product [Product] Product to put - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def post_async_relative_retry_invalid_header(product = nil, custom_headers = nil) - # Send request - promise = begin_post_async_relative_retry_invalid_header(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running post request, service returns a 202 to the initial request, - # with an entity that contains ProvisioningState=’Creating’. The endpoint - # indicated in the Azure-AsyncOperation header is invalid. - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_post_async_relative_retry_invalid_header(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/error/postasync/retry/invalidheader" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Long running post request, service returns a 202 to the initial request, - # with an entity that contains ProvisioningState=’Creating’. Poll the - # endpoint indicated in the Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @return [Concurrent::Promise] promise which provides async access to http - # response. - # - def post_async_relative_retry_invalid_json_polling(product = nil, custom_headers = nil) - # Send request - promise = begin_post_async_relative_retry_invalid_json_polling(product, custom_headers) - - promise = promise.then do |response| - # Defining deserialization method. - deserialize_method = lambda do |parsed_response| - end - - # Waiting for response. - @client.get_post_or_delete_operation_result(response, nil, deserialize_method) - end - - promise - end - - # - # Long running post request, service returns a 202 to the initial request, - # with an entity that contains ProvisioningState=’Creating’. Poll the - # endpoint indicated in the Azure-AsyncOperation header for operation status - # - # @param product [Product] Product to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def begin_post_async_relative_retry_invalid_json_polling(product = nil, custom_headers = nil) - product.validate unless product.nil? - # Construct URL - path = "/lro/error/postasync/retry/invalidjsonpolling" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless product.nil? - product = Product.serialize_object(product) - end - request_content = JSON.generate(product, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/models/operation_result.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/models/operation_result.rb deleted file mode 100644 index 4f61cfbb9..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/models/operation_result.rb +++ /dev/null @@ -1,79 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module LroModule - module Models - # - # Model object. - # - class OperationResult - - include MsRestAzure - - # @return The status of the request. Possible values for this property - # include: 'Succeeded', 'Failed', 'canceled', 'Accepted', 'Creating', - # 'Created', 'Updating', 'Updated', 'Deleting', 'Deleted', 'OK'. - attr_accessor :status - - # @return [OperationResultError] - attr_accessor :error - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - @error.validate unless @error.nil? - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.status - output_object['status'] = serialized_property unless serialized_property.nil? - - serialized_property = object.error - unless serialized_property.nil? - serialized_property = OperationResultError.serialize_object(serialized_property) - end - output_object['error'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [OperationResult] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = OperationResult.new - - deserialized_property = object['status'] - output_object.status = deserialized_property - - deserialized_property = object['error'] - unless deserialized_property.nil? - deserialized_property = OperationResultError.deserialize_object(deserialized_property) - end - output_object.error = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/models/operation_result_error.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/models/operation_result_error.rb deleted file mode 100644 index 5e4d12def..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/models/operation_result_error.rb +++ /dev/null @@ -1,72 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module LroModule - module Models - # - # Model object. - # - class OperationResultError - - include MsRestAzure - - # @return [Integer] The error code for an operation failure - attr_accessor :code - - # @return [String] The detailed arror message - attr_accessor :message - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.code - output_object['code'] = serialized_property unless serialized_property.nil? - - serialized_property = object.message - output_object['message'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [OperationResultError] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = OperationResultError.new - - deserialized_property = object['code'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.code = deserialized_property - - deserialized_property = object['message'] - output_object.message = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/models/product.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/models/product.rb deleted file mode 100644 index b2400912a..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/models/product.rb +++ /dev/null @@ -1,98 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module LroModule - module Models - # - # Model object. - # - class Product < MsRestAzure::Resource - - include MsRestAzure - - # @return [ProductProperties] - attr_accessor :properties - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - @properties.validate unless @properties.nil? - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.id - output_object['id'] = serialized_property unless serialized_property.nil? - - serialized_property = object.type - output_object['type'] = serialized_property unless serialized_property.nil? - - serialized_property = object.tags - output_object['tags'] = serialized_property unless serialized_property.nil? - - serialized_property = object.location - output_object['location'] = serialized_property unless serialized_property.nil? - - serialized_property = object.name - output_object['name'] = serialized_property unless serialized_property.nil? - - serialized_property = object.properties - unless serialized_property.nil? - serialized_property = ProductProperties.serialize_object(serialized_property) - end - output_object['properties'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Product] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Product.new - - deserialized_property = object['id'] - output_object.id = deserialized_property - - deserialized_property = object['type'] - output_object.type = deserialized_property - - deserialized_property = object['tags'] - output_object.tags = deserialized_property - - deserialized_property = object['location'] - output_object.location = deserialized_property - - deserialized_property = object['name'] - output_object.name = deserialized_property - - deserialized_property = object['properties'] - unless deserialized_property.nil? - deserialized_property = ProductProperties.deserialize_object(deserialized_property) - end - output_object.properties = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/models/product_properties.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/models/product_properties.rb deleted file mode 100644 index c5964423f..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/models/product_properties.rb +++ /dev/null @@ -1,72 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module LroModule - module Models - # - # Model object. - # - class ProductProperties - - include MsRestAzure - - # @return [String] - attr_accessor :provisioning_state - - # @return Possible values for this property include: 'Succeeded', - # 'Failed', 'canceled', 'Accepted', 'Creating', 'Created', 'Updating', - # 'Updated', 'Deleting', 'Deleted', 'OK'. - attr_accessor :provisioning_state_values - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.provisioning_state - output_object['provisioningState'] = serialized_property unless serialized_property.nil? - - serialized_property = object.provisioning_state_values - output_object['provisioningStateValues'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [ProductProperties] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = ProductProperties.new - - deserialized_property = object['provisioningState'] - output_object.provisioning_state = deserialized_property - - deserialized_property = object['provisioningStateValues'] - output_object.provisioning_state_values = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/models/sku.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/models/sku.rb deleted file mode 100644 index 7bb462df8..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/models/sku.rb +++ /dev/null @@ -1,71 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module LroModule - module Models - # - # Model object. - # - class Sku - - include MsRestAzure - - # @return [String] - attr_accessor :name - - # @return [String] - attr_accessor :id - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.name - output_object['name'] = serialized_property unless serialized_property.nil? - - serialized_property = object.id - output_object['id'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Sku] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Sku.new - - deserialized_property = object['name'] - output_object.name = deserialized_property - - deserialized_property = object['id'] - output_object.id = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/models/sub_product.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/models/sub_product.rb deleted file mode 100644 index e09749c12..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/models/sub_product.rb +++ /dev/null @@ -1,74 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module LroModule - module Models - # - # Model object. - # - class SubProduct < MsRestAzure::SubResource - - include MsRestAzure - - # @return [SubProductProperties] - attr_accessor :properties - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - @properties.validate unless @properties.nil? - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.id - output_object['id'] = serialized_property unless serialized_property.nil? - - serialized_property = object.properties - unless serialized_property.nil? - serialized_property = SubProductProperties.serialize_object(serialized_property) - end - output_object['properties'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [SubProduct] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = SubProduct.new - - deserialized_property = object['id'] - output_object.id = deserialized_property - - deserialized_property = object['properties'] - unless deserialized_property.nil? - deserialized_property = SubProductProperties.deserialize_object(deserialized_property) - end - output_object.properties = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/models/sub_product_properties.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/models/sub_product_properties.rb deleted file mode 100644 index de6cd18c5..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/lro/lro/models/sub_product_properties.rb +++ /dev/null @@ -1,72 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module LroModule - module Models - # - # Model object. - # - class SubProductProperties - - include MsRestAzure - - # @return [String] - attr_accessor :provisioning_state - - # @return Possible values for this property include: 'Succeeded', - # 'Failed', 'canceled', 'Accepted', 'Creating', 'Created', 'Updating', - # 'Updated', 'Deleting', 'Deleted', 'OK'. - attr_accessor :provisioning_state_values - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.provisioning_state - output_object['provisioningState'] = serialized_property unless serialized_property.nil? - - serialized_property = object.provisioning_state_values - output_object['provisioningStateValues'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [SubProductProperties] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = SubProductProperties.new - - deserialized_property = object['provisioningState'] - output_object.provisioning_state = deserialized_property - - deserialized_property = object['provisioningStateValues'] - output_object.provisioning_state_values = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/paging/paging.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/paging/paging.rb deleted file mode 100644 index 45c306334..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/paging/paging.rb +++ /dev/null @@ -1,35 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -require 'uri' -require 'cgi' -require 'date' -require 'json' -require 'base64' -require 'erb' -require 'securerandom' -require 'time' -require 'timeliness' -require 'faraday' -require 'faraday-cookie_jar' -require 'concurrent' -require 'ms_rest' -require 'ms_rest_azure' - -module PagingModule - autoload :Paging, 'paging/paging.rb' - autoload :AutoRestPagingTestService, 'paging/auto_rest_paging_test_service.rb' - - module Models - autoload :ProductResult, 'paging/models/product_result.rb' - autoload :Product, 'paging/models/product.rb' - autoload :ProductProperties, 'paging/models/product_properties.rb' - autoload :OperationResult, 'paging/models/operation_result.rb' - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/paging/paging/auto_rest_paging_test_service.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/paging/paging/auto_rest_paging_test_service.rb deleted file mode 100644 index f2ea9fac0..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/paging/paging/auto_rest_paging_test_service.rb +++ /dev/null @@ -1,56 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module PagingModule - # - # A service client - single point of access to the REST API. - # - class AutoRestPagingTestService < MsRestAzure::AzureServiceClient - include PagingModule::Models - include MsRestAzure - - # @return [String] the base URI of the service. - attr_accessor :base_url - - # @return The management credentials for Azure. - attr_reader :credentials - - # @return [String] Gets or sets the preferred language for the response. - attr_accessor :accept_language - - # @return [Integer] The retry timeout for Long Running Operations. - attr_accessor :long_running_operation_retry_timeout - - # @return Subscription credentials which uniquely identify client - # subscription. - attr_accessor :credentials - - # @return paging - attr_reader :paging - - # - # Creates initializes a new instance of the AutoRestPagingTestService class. - # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. - # @param base_url [String] the base URI of the service. - # @param options [Array] filters to be applied to the HTTP requests. - # - def initialize(credentials, base_url = nil, options = nil) - super(credentials, options) - @base_url = base_url || 'http://localhost' - - fail ArgumentError, 'credentials is nil' if credentials.nil? - fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) - @credentials = credentials - - @paging = Paging.new(self) - @accept_language = "en-US" - end - - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/paging/paging/models/operation_result.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/paging/paging/models/operation_result.rb deleted file mode 100644 index 25666aabe..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/paging/paging/models/operation_result.rb +++ /dev/null @@ -1,63 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module PagingModule - module Models - # - # Model object. - # - class OperationResult - - include MsRestAzure - - # @return The status of the request. Possible values for this property - # include: 'Succeeded', 'Failed', 'canceled', 'Accepted', 'Creating', - # 'Created', 'Updating', 'Updated', 'Deleting', 'Deleted', 'OK'. - attr_accessor :status - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.status - output_object['status'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [OperationResult] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = OperationResult.new - - deserialized_property = object['status'] - output_object.status = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/paging/paging/models/product.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/paging/paging/models/product.rb deleted file mode 100644 index 9973e0855..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/paging/paging/models/product.rb +++ /dev/null @@ -1,68 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module PagingModule - module Models - # - # Model object. - # - class Product - - include MsRestAzure - - # @return [ProductProperties] - attr_accessor :properties - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - @properties.validate unless @properties.nil? - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.properties - unless serialized_property.nil? - serialized_property = ProductProperties.serialize_object(serialized_property) - end - output_object['properties'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Product] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Product.new - - deserialized_property = object['properties'] - unless deserialized_property.nil? - deserialized_property = ProductProperties.deserialize_object(deserialized_property) - end - output_object.properties = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/paging/paging/models/product_properties.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/paging/paging/models/product_properties.rb deleted file mode 100644 index 69576a966..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/paging/paging/models/product_properties.rb +++ /dev/null @@ -1,72 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module PagingModule - module Models - # - # Model object. - # - class ProductProperties - - include MsRestAzure - - # @return [Integer] - attr_accessor :id - - # @return [String] - attr_accessor :name - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.id - output_object['id'] = serialized_property unless serialized_property.nil? - - serialized_property = object.name - output_object['name'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [ProductProperties] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = ProductProperties.new - - deserialized_property = object['id'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.id = deserialized_property - - deserialized_property = object['name'] - output_object.name = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/paging/paging/models/product_result.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/paging/paging/models/product_result.rb deleted file mode 100644 index f21bb66d5..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/paging/paging/models/product_result.rb +++ /dev/null @@ -1,91 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module PagingModule - module Models - # - # Model object. - # - class ProductResult - - include MsRestAzure - - # @return [Array] - attr_accessor :values - - # @return [String] - attr_accessor :next_link - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - @values.each{ |e| e.validate if e.respond_to?(:validate) } unless @values.nil? - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.values - unless serialized_property.nil? - serializedArray = [] - serialized_property.each do |element| - unless element.nil? - element = Product.serialize_object(element) - end - serializedArray.push(element) - end - serialized_property = serializedArray - end - output_object['values'] = serialized_property unless serialized_property.nil? - - serialized_property = object.next_link - output_object['nextLink'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [ProductResult] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = ProductResult.new - - deserialized_property = object['values'] - unless deserialized_property.nil? - deserializedArray = []; - deserialized_property.each do |element1| - unless element1.nil? - element1 = Product.deserialize_object(element1) - end - deserializedArray.push(element1); - end - deserialized_property = deserializedArray; - end - output_object.values = deserialized_property - - deserialized_property = object['nextLink'] - output_object.next_link = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/paging/paging/paging.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/paging/paging/paging.rb deleted file mode 100644 index 896c60471..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/paging/paging/paging.rb +++ /dev/null @@ -1,1202 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module PagingModule - # - # Long-running Operation for AutoRest - # - class Paging - include PagingModule::Models - include MsRestAzure - - # - # Creates and initializes a new instance of the Paging class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestPagingTestService - attr_reader :client - - # - # A paging operation that finishes on the first call without a nextlink - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_single_pages(custom_headers = nil) - # Construct URL - path = "/paging/single" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = ProductResult.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # A paging operation that includes a nextLink that has 10 pages - # - # @param client_request_id [String] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_multiple_pages(client_request_id = nil, custom_headers = nil) - # Construct URL - path = "/paging/multiple" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["client-request-id"] = client_request_id unless client_request_id.nil? - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = ProductResult.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # A paging operation that fails on the first call with 500 and then retries - # and then get a response including a nextLink that has 10 pages - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_multiple_pages_retry_first(custom_headers = nil) - # Construct URL - path = "/paging/multiple/retryfirst" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = ProductResult.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # A paging operation that includes a nextLink that has 10 pages, of which the - # 2nd call fails first with 500. The client should retry and finish all 10 - # pages eventually. - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_multiple_pages_retry_second(custom_headers = nil) - # Construct URL - path = "/paging/multiple/retrysecond" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = ProductResult.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # A paging operation that receives a 400 on the first call - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_single_pages_failure(custom_headers = nil) - # Construct URL - path = "/paging/single/failure" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = ProductResult.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # A paging operation that receives a 400 on the second call - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_multiple_pages_failure(custom_headers = nil) - # Construct URL - path = "/paging/multiple/failure" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = ProductResult.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # A paging operation that receives an invalid nextLink - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_multiple_pages_failure_uri(custom_headers = nil) - # Construct URL - path = "/paging/multiple/failureuri" - url = URI.join(@client.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = ProductResult.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # A paging operation that finishes on the first call without a nextlink - # - # @param next_page_link [String] The NextLink from the previous successful - # call to List operation. - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_single_pages_next(next_page_link, custom_headers = nil) - fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? - # Construct URL - path = "{nextLink}" - path['{nextLink}'] = next_page_link if path.include?('{nextLink}') - url = URI.parse(path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = ProductResult.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # A paging operation that includes a nextLink that has 10 pages - # - # @param next_page_link [String] The NextLink from the previous successful - # call to List operation. - # @param client_request_id [String] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_multiple_pages_next(next_page_link, client_request_id = nil, custom_headers = nil) - fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? - # Construct URL - path = "{nextLink}" - path['{nextLink}'] = next_page_link if path.include?('{nextLink}') - url = URI.parse(path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["client-request-id"] = client_request_id unless client_request_id.nil? - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = ProductResult.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # A paging operation that fails on the first call with 500 and then retries - # and then get a response including a nextLink that has 10 pages - # - # @param next_page_link [String] The NextLink from the previous successful - # call to List operation. - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_multiple_pages_retry_first_next(next_page_link, custom_headers = nil) - fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? - # Construct URL - path = "{nextLink}" - path['{nextLink}'] = next_page_link if path.include?('{nextLink}') - url = URI.parse(path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = ProductResult.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # A paging operation that includes a nextLink that has 10 pages, of which the - # 2nd call fails first with 500. The client should retry and finish all 10 - # pages eventually. - # - # @param next_page_link [String] The NextLink from the previous successful - # call to List operation. - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_multiple_pages_retry_second_next(next_page_link, custom_headers = nil) - fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? - # Construct URL - path = "{nextLink}" - path['{nextLink}'] = next_page_link if path.include?('{nextLink}') - url = URI.parse(path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = ProductResult.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # A paging operation that receives a 400 on the first call - # - # @param next_page_link [String] The NextLink from the previous successful - # call to List operation. - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_single_pages_failure_next(next_page_link, custom_headers = nil) - fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? - # Construct URL - path = "{nextLink}" - path['{nextLink}'] = next_page_link if path.include?('{nextLink}') - url = URI.parse(path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = ProductResult.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # A paging operation that receives a 400 on the second call - # - # @param next_page_link [String] The NextLink from the previous successful - # call to List operation. - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_multiple_pages_failure_next(next_page_link, custom_headers = nil) - fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? - # Construct URL - path = "{nextLink}" - path['{nextLink}'] = next_page_link if path.include?('{nextLink}') - url = URI.parse(path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = ProductResult.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # A paging operation that receives an invalid nextLink - # - # @param next_page_link [String] The NextLink from the previous successful - # call to List operation. - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_multiple_pages_failure_uri_next(next_page_link, custom_headers = nil) - fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? - # Construct URL - path = "{nextLink}" - path['{nextLink}'] = next_page_link if path.include?('{nextLink}') - url = URI.parse(path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = ProductResult.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/resource_flattening/resource_flattening.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/resource_flattening/resource_flattening.rb deleted file mode 100644 index 9cabb5781..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/resource_flattening/resource_flattening.rb +++ /dev/null @@ -1,34 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -require 'uri' -require 'cgi' -require 'date' -require 'json' -require 'base64' -require 'erb' -require 'securerandom' -require 'time' -require 'timeliness' -require 'faraday' -require 'faraday-cookie_jar' -require 'concurrent' -require 'ms_rest' -require 'ms_rest_azure' - -module ResourceFlatteningModule - autoload :AutoRestResourceFlatteningTestService, 'resource_flattening/auto_rest_resource_flattening_test_service.rb' - - module Models - autoload :Error, 'resource_flattening/models/error.rb' - autoload :FlattenedProductProperties, 'resource_flattening/models/flattened_product_properties.rb' - autoload :ResourceCollection, 'resource_flattening/models/resource_collection.rb' - autoload :FlattenedProduct, 'resource_flattening/models/flattened_product.rb' - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/resource_flattening/resource_flattening/auto_rest_resource_flattening_test_service.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/resource_flattening/resource_flattening/auto_rest_resource_flattening_test_service.rb deleted file mode 100644 index 1bafd3f05..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/resource_flattening/resource_flattening/auto_rest_resource_flattening_test_service.rb +++ /dev/null @@ -1,558 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ResourceFlatteningModule - # - # A service client - single point of access to the REST API. - # - class AutoRestResourceFlatteningTestService < MsRestAzure::AzureServiceClient - include ResourceFlatteningModule::Models - include MsRestAzure - - # @return [String] the base URI of the service. - attr_accessor :base_url - - # @return The management credentials for Azure. - attr_reader :credentials - - # @return [String] Gets or sets the preferred language for the response. - attr_accessor :accept_language - - # @return [Integer] The retry timeout for Long Running Operations. - attr_accessor :long_running_operation_retry_timeout - - # @return Subscription credentials which uniquely identify client - # subscription. - attr_accessor :credentials - - # - # Creates initializes a new instance of the AutoRestResourceFlatteningTestService class. - # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. - # @param base_url [String] the base URI of the service. - # @param options [Array] filters to be applied to the HTTP requests. - # - def initialize(credentials, base_url = nil, options = nil) - super(credentials, options) - @base_url = base_url || 'http://localhost' - - fail ArgumentError, 'credentials is nil' if credentials.nil? - fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) - @credentials = credentials - - @accept_language = "en-US" - end - - # - # Put External Resource as an Array - # - # @param resource_array [Array] External Resource as an Array to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_array(resource_array = nil, custom_headers = nil) - resource_array.each{ |e| e.validate if e.respond_to?(:validate) } unless resource_array.nil? - # Construct URL - path = "/azure/resource-flatten/array" - url = URI.join(self.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = accept_language unless accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless resource_array.nil? - serializedArray = [] - resource_array.each do |element| - unless element.nil? - element = Resource.serialize_object(element) - end - serializedArray.push(element) - end - resource_array = serializedArray - end - request_content = JSON.generate(resource_array, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - self.credentials.sign_request(request) unless self.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Get External Resource as an Array - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_array(custom_headers = nil) - # Construct URL - path = "/azure/resource-flatten/array" - url = URI.join(self.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = accept_language unless accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - self.credentials.sign_request(request) unless self.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - deserializedArray = []; - parsed_response.each do |element| - unless element.nil? - element = FlattenedProduct.deserialize_object(element) - end - deserializedArray.push(element); - end - parsed_response = deserializedArray; - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put External Resource as a Dictionary - # - # @param resource_dictionary [Hash{String => FlattenedProduct}] External - # Resource as a Dictionary to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_dictionary(resource_dictionary = nil, custom_headers = nil) - resource_dictionary.each{ |e| e.validate if e.respond_to?(:validate) } unless resource_dictionary.nil? - # Construct URL - path = "/azure/resource-flatten/dictionary" - url = URI.join(self.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = accept_language unless accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless resource_dictionary.nil? - resource_dictionary.each { |key, valueElement| - unless valueElement.nil? - valueElement = FlattenedProduct.serialize_object(valueElement) - end - resource_dictionary[key] = valueElement - } - end - request_content = JSON.generate(resource_dictionary, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - self.credentials.sign_request(request) unless self.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Get External Resource as a Dictionary - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_dictionary(custom_headers = nil) - # Construct URL - path = "/azure/resource-flatten/dictionary" - url = URI.join(self.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = accept_language unless accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - self.credentials.sign_request(request) unless self.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response.each do |key, valueElement| - unless valueElement.nil? - valueElement = FlattenedProduct.deserialize_object(valueElement) - end - parsed_response[key] = valueElement - end - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put External Resource as a ResourceCollection - # - # @param resource_complex_object [ResourceCollection] External Resource as a - # ResourceCollection to put - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_resource_collection(resource_complex_object = nil, custom_headers = nil) - resource_complex_object.validate unless resource_complex_object.nil? - # Construct URL - path = "/azure/resource-flatten/resourcecollection" - url = URI.join(self.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = accept_language unless accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless resource_complex_object.nil? - resource_complex_object = ResourceCollection.serialize_object(resource_complex_object) - end - request_content = JSON.generate(resource_complex_object, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - self.credentials.sign_request(request) unless self.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - - result - end - - promise.execute - end - - # - # Get External Resource as a ResourceCollection - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_resource_collection(custom_headers = nil) - # Construct URL - path = "/azure/resource-flatten/resourcecollection" - url = URI.join(self.base_url, path) - properties = {} - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers['x-ms-client-request-id'] = SecureRandom.uuid - request_headers["accept-language"] = accept_language unless accept_language.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - self.credentials.sign_request(request) unless self.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRestAzure::AzureOperationResponse.new(connection, http_response) - result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = ResourceCollection.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/resource_flattening/resource_flattening/models/error.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/resource_flattening/resource_flattening/models/error.rb deleted file mode 100644 index b621ca61e..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/resource_flattening/resource_flattening/models/error.rb +++ /dev/null @@ -1,72 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ResourceFlatteningModule - module Models - # - # Model object. - # - class Error - - include MsRestAzure - - # @return [Integer] - attr_accessor :status - - # @return [String] - attr_accessor :message - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.status - output_object['status'] = serialized_property unless serialized_property.nil? - - serialized_property = object.message - output_object['message'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Error] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Error.new - - deserialized_property = object['status'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.status = deserialized_property - - deserialized_property = object['message'] - output_object.message = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/resource_flattening/resource_flattening/models/flattened_product.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/resource_flattening/resource_flattening/models/flattened_product.rb deleted file mode 100644 index fb521c1b0..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/resource_flattening/resource_flattening/models/flattened_product.rb +++ /dev/null @@ -1,98 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ResourceFlatteningModule - module Models - # - # Model object. - # - class FlattenedProduct < MsRestAzure::Resource - - include MsRestAzure - - # @return [FlattenedProductProperties] - attr_accessor :properties - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - @properties.validate unless @properties.nil? - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.id - output_object['id'] = serialized_property unless serialized_property.nil? - - serialized_property = object.type - output_object['type'] = serialized_property unless serialized_property.nil? - - serialized_property = object.tags - output_object['tags'] = serialized_property unless serialized_property.nil? - - serialized_property = object.location - output_object['location'] = serialized_property unless serialized_property.nil? - - serialized_property = object.name - output_object['name'] = serialized_property unless serialized_property.nil? - - serialized_property = object.properties - unless serialized_property.nil? - serialized_property = FlattenedProductProperties.serialize_object(serialized_property) - end - output_object['properties'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [FlattenedProduct] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = FlattenedProduct.new - - deserialized_property = object['id'] - output_object.id = deserialized_property - - deserialized_property = object['type'] - output_object.type = deserialized_property - - deserialized_property = object['tags'] - output_object.tags = deserialized_property - - deserialized_property = object['location'] - output_object.location = deserialized_property - - deserialized_property = object['name'] - output_object.name = deserialized_property - - deserialized_property = object['properties'] - unless deserialized_property.nil? - deserialized_property = FlattenedProductProperties.deserialize_object(deserialized_property) - end - output_object.properties = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/resource_flattening/resource_flattening/models/flattened_product_properties.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/resource_flattening/resource_flattening/models/flattened_product_properties.rb deleted file mode 100644 index 82053f3f1..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/resource_flattening/resource_flattening/models/flattened_product_properties.rb +++ /dev/null @@ -1,90 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ResourceFlatteningModule - module Models - # - # Model object. - # - class FlattenedProductProperties - - include MsRestAzure - - # @return [String] - attr_accessor :pname - - # @return [String] - attr_accessor :type - - # @return Possible values for this property include: 'Succeeded', - # 'Failed', 'canceled', 'Accepted', 'Creating', 'Created', 'Updating', - # 'Updated', 'Deleting', 'Deleted', 'OK'. - attr_accessor :provisioning_state_values - - # @return [String] - attr_accessor :provisioning_state - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.pname - output_object['pname'] = serialized_property unless serialized_property.nil? - - serialized_property = object.type - output_object['type'] = serialized_property unless serialized_property.nil? - - serialized_property = object.provisioning_state_values - output_object['provisioningStateValues'] = serialized_property unless serialized_property.nil? - - serialized_property = object.provisioning_state - output_object['provisioningState'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [FlattenedProductProperties] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = FlattenedProductProperties.new - - deserialized_property = object['pname'] - output_object.pname = deserialized_property - - deserialized_property = object['type'] - output_object.type = deserialized_property - - deserialized_property = object['provisioningStateValues'] - output_object.provisioning_state_values = deserialized_property - - deserialized_property = object['provisioningState'] - output_object.provisioning_state = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/resource_flattening/resource_flattening/models/resource_collection.rb b/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/resource_flattening/resource_flattening/models/resource_collection.rb deleted file mode 100644 index 63ce2f3c7..000000000 --- a/AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/Generated/resource_flattening/resource_flattening/models/resource_collection.rb +++ /dev/null @@ -1,124 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ResourceFlatteningModule - module Models - # - # Model object. - # - class ResourceCollection - - include MsRestAzure - - # @return [FlattenedProduct] - attr_accessor :productresource - - # @return [Array] - attr_accessor :arrayofresources - - # @return [Hash{String => FlattenedProduct}] - attr_accessor :dictionaryofresources - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - @productresource.validate unless @productresource.nil? - @arrayofresources.each{ |e| e.validate if e.respond_to?(:validate) } unless @arrayofresources.nil? - @dictionaryofresources.each{ |e| e.validate if e.respond_to?(:validate) } unless @dictionaryofresources.nil? - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.productresource - unless serialized_property.nil? - serialized_property = FlattenedProduct.serialize_object(serialized_property) - end - output_object['productresource'] = serialized_property unless serialized_property.nil? - - serialized_property = object.arrayofresources - unless serialized_property.nil? - serializedArray = [] - serialized_property.each do |element| - unless element.nil? - element = FlattenedProduct.serialize_object(element) - end - serializedArray.push(element) - end - serialized_property = serializedArray - end - output_object['arrayofresources'] = serialized_property unless serialized_property.nil? - - serialized_property = object.dictionaryofresources - unless serialized_property.nil? - serialized_property.each { |key, valueElement| - unless valueElement.nil? - valueElement = FlattenedProduct.serialize_object(valueElement) - end - serialized_property[key] = valueElement - } - end - output_object['dictionaryofresources'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [ResourceCollection] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = ResourceCollection.new - - deserialized_property = object['productresource'] - unless deserialized_property.nil? - deserialized_property = FlattenedProduct.deserialize_object(deserialized_property) - end - output_object.productresource = deserialized_property - - deserialized_property = object['arrayofresources'] - unless deserialized_property.nil? - deserializedArray = []; - deserialized_property.each do |element1| - unless element1.nil? - element1 = FlattenedProduct.deserialize_object(element1) - end - deserializedArray.push(element1); - end - deserialized_property = deserializedArray; - end - output_object.arrayofresources = deserialized_property - - deserialized_property = object['dictionaryofresources'] - unless deserialized_property.nil? - deserialized_property.each do |key, valueElement1| - unless valueElement1.nil? - valueElement1 = FlattenedProduct.deserialize_object(valueElement1) - end - deserialized_property[key] = valueElement1 - end - end - output_object.dictionaryofresources = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/array/body_array.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/array/body_array.rb deleted file mode 100644 index 47b0012d3..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/array/body_array.rb +++ /dev/null @@ -1,32 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -require 'uri' -require 'cgi' -require 'date' -require 'json' -require 'base64' -require 'erb' -require 'securerandom' -require 'time' -require 'timeliness' -require 'faraday' -require 'faraday-cookie_jar' -require 'concurrent' -require 'ms_rest' - -module ArrayModule - autoload :Array, 'body_array/array.rb' - autoload :AutoRestSwaggerBATArrayService, 'body_array/auto_rest_swagger_batarray_service.rb' - - module Models - autoload :Product, 'body_array/models/product.rb' - autoload :Error, 'body_array/models/error.rb' - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/array/body_array/array.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/array/body_array/array.rb deleted file mode 100644 index 36dffe57b..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/array/body_array/array.rb +++ /dev/null @@ -1,4215 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ArrayModule - # - # Test Infrastructure for AutoRest Swagger BAT - # - class Array - include ArrayModule::Models - - # - # Creates and initializes a new instance of the Array class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestSwaggerBATArrayService - attr_reader :client - - # - # Get null array value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_null(custom_headers = nil) - # Construct URL - path = "/array/null" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - deserializedArray = []; - parsed_response.each do |element| - element = Integer(element) unless element.to_s.empty? - deserializedArray.push(element); - end - parsed_response = deserializedArray; - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get invalid array [1, 2, 3 - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_invalid(custom_headers = nil) - # Construct URL - path = "/array/invalid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - deserializedArray = []; - parsed_response.each do |element| - element = Integer(element) unless element.to_s.empty? - deserializedArray.push(element); - end - parsed_response = deserializedArray; - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get empty array value [] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_empty(custom_headers = nil) - # Construct URL - path = "/array/empty" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - deserializedArray = []; - parsed_response.each do |element| - element = Integer(element) unless element.to_s.empty? - deserializedArray.push(element); - end - parsed_response = deserializedArray; - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Set array value empty [] - # - # @param array_body [Array] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_empty(array_body, custom_headers = nil) - fail ArgumentError, 'array_body is nil' if array_body.nil? - array_body.each{ |e| e.validate if e.respond_to?(:validate) } unless array_body.nil? - # Construct URL - path = "/array/empty" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(array_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get boolean array value [true, false, false, true] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_boolean_tfft(custom_headers = nil) - # Construct URL - path = "/array/prim/boolean/tfft" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Set array value empty [true, false, false, true] - # - # @param array_body [Array] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_boolean_tfft(array_body, custom_headers = nil) - fail ArgumentError, 'array_body is nil' if array_body.nil? - array_body.each{ |e| e.validate if e.respond_to?(:validate) } unless array_body.nil? - # Construct URL - path = "/array/prim/boolean/tfft" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(array_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get boolean array value [true, null, false] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_boolean_invalid_null(custom_headers = nil) - # Construct URL - path = "/array/prim/boolean/true.null.false" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get boolean array value [true, 'boolean', false] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_boolean_invalid_string(custom_headers = nil) - # Construct URL - path = "/array/prim/boolean/true.boolean.false" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get integer array value [1, -1, 3, 300] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_integer_valid(custom_headers = nil) - # Construct URL - path = "/array/prim/integer/1.-1.3.300" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - deserializedArray = []; - parsed_response.each do |element| - element = Integer(element) unless element.to_s.empty? - deserializedArray.push(element); - end - parsed_response = deserializedArray; - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Set array value empty [1, -1, 3, 300] - # - # @param array_body [Array] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_integer_valid(array_body, custom_headers = nil) - fail ArgumentError, 'array_body is nil' if array_body.nil? - array_body.each{ |e| e.validate if e.respond_to?(:validate) } unless array_body.nil? - # Construct URL - path = "/array/prim/integer/1.-1.3.300" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(array_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get integer array value [1, null, 0] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_int_invalid_null(custom_headers = nil) - # Construct URL - path = "/array/prim/integer/1.null.zero" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - deserializedArray = []; - parsed_response.each do |element| - element = Integer(element) unless element.to_s.empty? - deserializedArray.push(element); - end - parsed_response = deserializedArray; - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get integer array value [1, 'integer', 0] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_int_invalid_string(custom_headers = nil) - # Construct URL - path = "/array/prim/integer/1.integer.0" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - deserializedArray = []; - parsed_response.each do |element| - element = Integer(element) unless element.to_s.empty? - deserializedArray.push(element); - end - parsed_response = deserializedArray; - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get integer array value [1, -1, 3, 300] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_long_valid(custom_headers = nil) - # Construct URL - path = "/array/prim/long/1.-1.3.300" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - deserializedArray = []; - parsed_response.each do |element| - element = Integer(element) unless element.to_s.empty? - deserializedArray.push(element); - end - parsed_response = deserializedArray; - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Set array value empty [1, -1, 3, 300] - # - # @param array_body [Array] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_long_valid(array_body, custom_headers = nil) - fail ArgumentError, 'array_body is nil' if array_body.nil? - array_body.each{ |e| e.validate if e.respond_to?(:validate) } unless array_body.nil? - # Construct URL - path = "/array/prim/long/1.-1.3.300" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(array_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get long array value [1, null, 0] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_long_invalid_null(custom_headers = nil) - # Construct URL - path = "/array/prim/long/1.null.zero" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - deserializedArray = []; - parsed_response.each do |element| - element = Integer(element) unless element.to_s.empty? - deserializedArray.push(element); - end - parsed_response = deserializedArray; - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get long array value [1, 'integer', 0] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_long_invalid_string(custom_headers = nil) - # Construct URL - path = "/array/prim/long/1.integer.0" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - deserializedArray = []; - parsed_response.each do |element| - element = Integer(element) unless element.to_s.empty? - deserializedArray.push(element); - end - parsed_response = deserializedArray; - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get float array value [0, -0.01, 1.2e20] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_float_valid(custom_headers = nil) - # Construct URL - path = "/array/prim/float/0--0.01-1.2e20" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - deserializedArray = []; - parsed_response.each do |element| - element = Float(element) unless element.to_s.empty? - deserializedArray.push(element); - end - parsed_response = deserializedArray; - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Set array value [0, -0.01, 1.2e20] - # - # @param array_body [Array] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_float_valid(array_body, custom_headers = nil) - fail ArgumentError, 'array_body is nil' if array_body.nil? - array_body.each{ |e| e.validate if e.respond_to?(:validate) } unless array_body.nil? - # Construct URL - path = "/array/prim/float/0--0.01-1.2e20" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(array_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get float array value [0.0, null, -1.2e20] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_float_invalid_null(custom_headers = nil) - # Construct URL - path = "/array/prim/float/0.0-null-1.2e20" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - deserializedArray = []; - parsed_response.each do |element| - element = Float(element) unless element.to_s.empty? - deserializedArray.push(element); - end - parsed_response = deserializedArray; - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get boolean array value [1.0, 'number', 0.0] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_float_invalid_string(custom_headers = nil) - # Construct URL - path = "/array/prim/float/1.number.0" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - deserializedArray = []; - parsed_response.each do |element| - element = Float(element) unless element.to_s.empty? - deserializedArray.push(element); - end - parsed_response = deserializedArray; - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get float array value [0, -0.01, 1.2e20] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_double_valid(custom_headers = nil) - # Construct URL - path = "/array/prim/double/0--0.01-1.2e20" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - deserializedArray = []; - parsed_response.each do |element| - element = Float(element) unless element.to_s.empty? - deserializedArray.push(element); - end - parsed_response = deserializedArray; - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Set array value [0, -0.01, 1.2e20] - # - # @param array_body [Array] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_double_valid(array_body, custom_headers = nil) - fail ArgumentError, 'array_body is nil' if array_body.nil? - array_body.each{ |e| e.validate if e.respond_to?(:validate) } unless array_body.nil? - # Construct URL - path = "/array/prim/double/0--0.01-1.2e20" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(array_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get float array value [0.0, null, -1.2e20] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_double_invalid_null(custom_headers = nil) - # Construct URL - path = "/array/prim/double/0.0-null-1.2e20" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - deserializedArray = []; - parsed_response.each do |element| - element = Float(element) unless element.to_s.empty? - deserializedArray.push(element); - end - parsed_response = deserializedArray; - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get boolean array value [1.0, 'number', 0.0] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_double_invalid_string(custom_headers = nil) - # Construct URL - path = "/array/prim/double/1.number.0" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - deserializedArray = []; - parsed_response.each do |element| - element = Float(element) unless element.to_s.empty? - deserializedArray.push(element); - end - parsed_response = deserializedArray; - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get string array value ['foo1', 'foo2', 'foo3'] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_string_valid(custom_headers = nil) - # Construct URL - path = "/array/prim/string/foo1.foo2.foo3" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Set array value ['foo1', 'foo2', 'foo3'] - # - # @param array_body [Array] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_string_valid(array_body, custom_headers = nil) - fail ArgumentError, 'array_body is nil' if array_body.nil? - array_body.each{ |e| e.validate if e.respond_to?(:validate) } unless array_body.nil? - # Construct URL - path = "/array/prim/string/foo1.foo2.foo3" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(array_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get string array value ['foo', null, 'foo2'] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_string_with_null(custom_headers = nil) - # Construct URL - path = "/array/prim/string/foo.null.foo2" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get string array value ['foo', 123, 'foo2'] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_string_with_invalid(custom_headers = nil) - # Construct URL - path = "/array/prim/string/foo.123.foo2" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get integer array value ['2000-12-01', '1980-01-02', '1492-10-12'] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_date_valid(custom_headers = nil) - # Construct URL - path = "/array/prim/date/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - deserializedArray = []; - parsed_response.each do |element| - element = MsRest::Serialization.deserialize_date(element) unless element.to_s.empty? - deserializedArray.push(element); - end - parsed_response = deserializedArray; - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Set array value ['2000-12-01', '1980-01-02', '1492-10-12'] - # - # @param array_body [Array] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_date_valid(array_body, custom_headers = nil) - fail ArgumentError, 'array_body is nil' if array_body.nil? - array_body.each{ |e| e.validate if e.respond_to?(:validate) } unless array_body.nil? - # Construct URL - path = "/array/prim/date/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(array_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get date array value ['2012-01-01', null, '1776-07-04'] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_date_invalid_null(custom_headers = nil) - # Construct URL - path = "/array/prim/date/invalidnull" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - deserializedArray = []; - parsed_response.each do |element| - element = MsRest::Serialization.deserialize_date(element) unless element.to_s.empty? - deserializedArray.push(element); - end - parsed_response = deserializedArray; - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get date array value ['2011-03-22', 'date'] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_date_invalid_chars(custom_headers = nil) - # Construct URL - path = "/array/prim/date/invalidchars" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - deserializedArray = []; - parsed_response.each do |element| - element = MsRest::Serialization.deserialize_date(element) unless element.to_s.empty? - deserializedArray.push(element); - end - parsed_response = deserializedArray; - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get date-time array value ['2000-12-01t00:00:01z', - # '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00'] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_date_time_valid(custom_headers = nil) - # Construct URL - path = "/array/prim/date-time/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - deserializedArray = []; - parsed_response.each do |element| - element = DateTime.parse(element) unless element.to_s.empty? - deserializedArray.push(element); - end - parsed_response = deserializedArray; - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', - # '1492-10-12T10:15:01-08:00'] - # - # @param array_body [Array] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_date_time_valid(array_body, custom_headers = nil) - fail ArgumentError, 'array_body is nil' if array_body.nil? - array_body.each{ |e| e.validate if e.respond_to?(:validate) } unless array_body.nil? - # Construct URL - path = "/array/prim/date-time/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless array_body.nil? - serializedArray = [] - array_body.each do |element| - element = element.new_offset(0).strftime('%FT%TZ') - serializedArray.push(element) - end - array_body = serializedArray - end - request_content = JSON.generate(array_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get date array value ['2000-12-01t00:00:01z', null] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_date_time_invalid_null(custom_headers = nil) - # Construct URL - path = "/array/prim/date-time/invalidnull" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - deserializedArray = []; - parsed_response.each do |element| - element = DateTime.parse(element) unless element.to_s.empty? - deserializedArray.push(element); - end - parsed_response = deserializedArray; - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get date array value ['2000-12-01t00:00:01z', 'date-time'] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_date_time_invalid_chars(custom_headers = nil) - # Construct URL - path = "/array/prim/date-time/invalidchars" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - deserializedArray = []; - parsed_response.each do |element| - element = DateTime.parse(element) unless element.to_s.empty? - deserializedArray.push(element); - end - parsed_response = deserializedArray; - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get date-time array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan - # 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT'] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_date_time_rfc1123valid(custom_headers = nil) - # Construct URL - path = "/array/prim/date-time-rfc1123/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - deserializedArray = []; - parsed_response.each do |element| - element = DateTime.parse(element) unless element.to_s.empty? - deserializedArray.push(element); - end - parsed_response = deserializedArray; - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 - # 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT'] - # - # @param array_body [Array] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_date_time_rfc1123valid(array_body, custom_headers = nil) - fail ArgumentError, 'array_body is nil' if array_body.nil? - array_body.each{ |e| e.validate if e.respond_to?(:validate) } unless array_body.nil? - # Construct URL - path = "/array/prim/date-time-rfc1123/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless array_body.nil? - serializedArray = [] - array_body.each do |element| - element = element.new_offset(0).strftime('%a, %d %b %Y %H:%M:%S GMT') - serializedArray.push(element) - end - array_body = serializedArray - end - request_content = JSON.generate(array_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get duration array value ['P123DT22H14M12.011S', 'P5DT1H0M0S'] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_duration_valid(custom_headers = nil) - # Construct URL - path = "/array/prim/duration/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S'] - # - # @param array_body [Array] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_duration_valid(array_body, custom_headers = nil) - fail ArgumentError, 'array_body is nil' if array_body.nil? - array_body.each{ |e| e.validate if e.respond_to?(:validate) } unless array_body.nil? - # Construct URL - path = "/array/prim/duration/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(array_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get byte array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] - # with each item encoded in base64 - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_byte_valid(custom_headers = nil) - # Construct URL - path = "/array/prim/byte/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - deserializedArray = []; - parsed_response.each do |element| - element = Base64.strict_decode64(element).unpack('C*') unless element.to_s.empty? - deserializedArray.push(element); - end - parsed_response = deserializedArray; - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with - # each elementencoded in base 64 - # - # @param array_body [Array>] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_byte_valid(array_body, custom_headers = nil) - fail ArgumentError, 'array_body is nil' if array_body.nil? - array_body.each{ |e| e.validate if e.respond_to?(:validate) } unless array_body.nil? - # Construct URL - path = "/array/prim/byte/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless array_body.nil? - serializedArray = [] - array_body.each do |element| - element = Base64.strict_encode64(element.pack('c*')) - serializedArray.push(element) - end - array_body = serializedArray - end - request_content = JSON.generate(array_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get byte array value [hex(AB, AC, AD), null] with the first item base64 - # encoded - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_byte_invalid_null(custom_headers = nil) - # Construct URL - path = "/array/prim/byte/invalidnull" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - deserializedArray = []; - parsed_response.each do |element| - element = Base64.strict_decode64(element).unpack('C*') unless element.to_s.empty? - deserializedArray.push(element); - end - parsed_response = deserializedArray; - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get array of complex type null value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_complex_null(custom_headers = nil) - # Construct URL - path = "/array/complex/null" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - deserializedArray = []; - parsed_response.each do |element| - unless element.nil? - element = Product.deserialize_object(element) - end - deserializedArray.push(element); - end - parsed_response = deserializedArray; - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get empty array of complex type [] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_complex_empty(custom_headers = nil) - # Construct URL - path = "/array/complex/empty" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - deserializedArray = []; - parsed_response.each do |element| - unless element.nil? - element = Product.deserialize_object(element) - end - deserializedArray.push(element); - end - parsed_response = deserializedArray; - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get array of complex type with null item [{'integer': 1 'string': '2'}, - # null, {'integer': 5, 'string': '6'}] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_complex_item_null(custom_headers = nil) - # Construct URL - path = "/array/complex/itemnull" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - deserializedArray = []; - parsed_response.each do |element| - unless element.nil? - element = Product.deserialize_object(element) - end - deserializedArray.push(element); - end - parsed_response = deserializedArray; - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get array of complex type with empty item [{'integer': 1 'string': '2'}, {}, - # {'integer': 5, 'string': '6'}] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_complex_item_empty(custom_headers = nil) - # Construct URL - path = "/array/complex/itemempty" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - deserializedArray = []; - parsed_response.each do |element| - unless element.nil? - element = Product.deserialize_object(element) - end - deserializedArray.push(element); - end - parsed_response = deserializedArray; - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get array of complex type with [{'integer': 1 'string': '2'}, {'integer': 3, - # 'string': '4'}, {'integer': 5, 'string': '6'}] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_complex_valid(custom_headers = nil) - # Construct URL - path = "/array/complex/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - deserializedArray = []; - parsed_response.each do |element| - unless element.nil? - element = Product.deserialize_object(element) - end - deserializedArray.push(element); - end - parsed_response = deserializedArray; - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put an array of complex type with values [{'integer': 1 'string': '2'}, - # {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}] - # - # @param array_body [Array] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_complex_valid(array_body, custom_headers = nil) - fail ArgumentError, 'array_body is nil' if array_body.nil? - array_body.each{ |e| e.validate if e.respond_to?(:validate) } unless array_body.nil? - # Construct URL - path = "/array/complex/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless array_body.nil? - serializedArray = [] - array_body.each do |element| - unless element.nil? - element = Product.serialize_object(element) - end - serializedArray.push(element) - end - array_body = serializedArray - end - request_content = JSON.generate(array_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get a null array - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_array_null(custom_headers = nil) - # Construct URL - path = "/array/array/null" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get an empty array [] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_array_empty(custom_headers = nil) - # Construct URL - path = "/array/array/empty" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get an array of array of strings [['1', '2', '3'], null, ['7', '8', '9']] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_array_item_null(custom_headers = nil) - # Construct URL - path = "/array/array/itemnull" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get an array of array of strings [['1', '2', '3'], [], ['7', '8', '9']] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_array_item_empty(custom_headers = nil) - # Construct URL - path = "/array/array/itemempty" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get an array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', - # '8', '9']] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_array_valid(custom_headers = nil) - # Construct URL - path = "/array/array/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', - # '8', '9']] - # - # @param array_body [Array>] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_array_valid(array_body, custom_headers = nil) - fail ArgumentError, 'array_body is nil' if array_body.nil? - array_body.each{ |e| e.validate if e.respond_to?(:validate) } unless array_body.nil? - # Construct URL - path = "/array/array/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(array_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get an array of Dictionaries with value null - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_dictionary_null(custom_headers = nil) - # Construct URL - path = "/array/dictionary/null" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get an array of Dictionaries of type with value [] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_dictionary_empty(custom_headers = nil) - # Construct URL - path = "/array/dictionary/empty" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get an array of Dictionaries of type with value [{'1': - # 'one', '2': 'two', '3': 'three'}, null, {'7': 'seven', '8': 'eight', '9': - # 'nine'}] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_dictionary_item_null(custom_headers = nil) - # Construct URL - path = "/array/dictionary/itemnull" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get an array of Dictionaries of type with value [{'1': - # 'one', '2': 'two', '3': 'three'}, {}, {'7': 'seven', '8': 'eight', '9': - # 'nine'}] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_dictionary_item_empty(custom_headers = nil) - # Construct URL - path = "/array/dictionary/itemempty" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get an array of Dictionaries of type with value [{'1': - # 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, - # {'7': 'seven', '8': 'eight', '9': 'nine'}] - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_dictionary_valid(custom_headers = nil) - # Construct URL - path = "/array/dictionary/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get an array of Dictionaries of type with value [{'1': - # 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, - # {'7': 'seven', '8': 'eight', '9': 'nine'}] - # - # @param array_body [Array String}>] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_dictionary_valid(array_body, custom_headers = nil) - fail ArgumentError, 'array_body is nil' if array_body.nil? - array_body.each{ |e| e.validate if e.respond_to?(:validate) } unless array_body.nil? - # Construct URL - path = "/array/dictionary/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(array_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/array/body_array/auto_rest_swagger_batarray_service.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/array/body_array/auto_rest_swagger_batarray_service.rb deleted file mode 100644 index b50393929..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/array/body_array/auto_rest_swagger_batarray_service.rb +++ /dev/null @@ -1,41 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ArrayModule - # - # A service client - single point of access to the REST API. - # - class AutoRestSwaggerBATArrayService < MsRest::ServiceClient - include ArrayModule::Models - - # @return [String] the base URI of the service. - attr_accessor :base_url - - # @return array - attr_reader :array - - # - # Creates initializes a new instance of the AutoRestSwaggerBATArrayService class. - # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. - # @param base_url [String] the base URI of the service. - # @param options [Array] filters to be applied to the HTTP requests. - # - def initialize(credentials, base_url = nil, options = nil) - super(credentials, options) - @base_url = base_url || 'http://localhost' - - fail ArgumentError, 'credentials is nil' if credentials.nil? - fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) - @credentials = credentials - - @array = Array.new(self) - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/array/body_array/models/error.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/array/body_array/models/error.rb deleted file mode 100644 index 77b74a826..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/array/body_array/models/error.rb +++ /dev/null @@ -1,69 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ArrayModule - module Models - # - # Model object. - # - class Error - # @return [Integer] - attr_accessor :status - - # @return [String] - attr_accessor :message - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.status - output_object['status'] = serialized_property unless serialized_property.nil? - - serialized_property = object.message - output_object['message'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Error] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Error.new - - deserialized_property = object['status'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.status = deserialized_property - - deserialized_property = object['message'] - output_object.message = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/array/body_array/models/product.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/array/body_array/models/product.rb deleted file mode 100644 index 18135abf3..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/array/body_array/models/product.rb +++ /dev/null @@ -1,69 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ArrayModule - module Models - # - # Model object. - # - class Product - # @return [Integer] - attr_accessor :integer - - # @return [String] - attr_accessor :string - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.integer - output_object['integer'] = serialized_property unless serialized_property.nil? - - serialized_property = object.string - output_object['string'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Product] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Product.new - - deserialized_property = object['integer'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.integer = deserialized_property - - deserialized_property = object['string'] - output_object.string = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/boolean/body_boolean.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/boolean/body_boolean.rb deleted file mode 100644 index 0f3c77f3f..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/boolean/body_boolean.rb +++ /dev/null @@ -1,31 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -require 'uri' -require 'cgi' -require 'date' -require 'json' -require 'base64' -require 'erb' -require 'securerandom' -require 'time' -require 'timeliness' -require 'faraday' -require 'faraday-cookie_jar' -require 'concurrent' -require 'ms_rest' - -module BooleanModule - autoload :Bool, 'body_boolean/bool.rb' - autoload :AutoRestBoolTestService, 'body_boolean/auto_rest_bool_test_service.rb' - - module Models - autoload :Error, 'body_boolean/models/error.rb' - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/boolean/body_boolean/auto_rest_bool_test_service.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/boolean/body_boolean/auto_rest_bool_test_service.rb deleted file mode 100644 index 6f82d8eaa..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/boolean/body_boolean/auto_rest_bool_test_service.rb +++ /dev/null @@ -1,41 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module BooleanModule - # - # A service client - single point of access to the REST API. - # - class AutoRestBoolTestService < MsRest::ServiceClient - include BooleanModule::Models - - # @return [String] the base URI of the service. - attr_accessor :base_url - - # @return bool - attr_reader :bool - - # - # Creates initializes a new instance of the AutoRestBoolTestService class. - # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. - # @param base_url [String] the base URI of the service. - # @param options [Array] filters to be applied to the HTTP requests. - # - def initialize(credentials, base_url = nil, options = nil) - super(credentials, options) - @base_url = base_url || 'http://localhost' - - fail ArgumentError, 'credentials is nil' if credentials.nil? - fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) - @credentials = credentials - - @bool = Bool.new(self) - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/boolean/body_boolean/bool.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/boolean/body_boolean/bool.rb deleted file mode 100644 index 10fc20fd6..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/boolean/body_boolean/bool.rb +++ /dev/null @@ -1,409 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module BooleanModule - # - # Test Infrastructure for AutoRest - # - class Bool - include BooleanModule::Models - - # - # Creates and initializes a new instance of the Bool class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestBoolTestService - attr_reader :client - - # - # Get true Boolean value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_true(custom_headers = nil) - # Construct URL - path = "/bool/true" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Set Boolean value true - # - # @param bool_body [Boolean] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_true(bool_body, custom_headers = nil) - fail ArgumentError, 'bool_body is nil' if bool_body.nil? - # Construct URL - path = "/bool/true" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(bool_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get false Boolean value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_false(custom_headers = nil) - # Construct URL - path = "/bool/false" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Set Boolean value false - # - # @param bool_body [Boolean] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_false(bool_body, custom_headers = nil) - fail ArgumentError, 'bool_body is nil' if bool_body.nil? - # Construct URL - path = "/bool/false" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(bool_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null Boolean value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_null(custom_headers = nil) - # Construct URL - path = "/bool/null" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get invalid Boolean value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_invalid(custom_headers = nil) - # Construct URL - path = "/bool/invalid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/boolean/body_boolean/models/error.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/boolean/body_boolean/models/error.rb deleted file mode 100644 index c9f5e2e0b..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/boolean/body_boolean/models/error.rb +++ /dev/null @@ -1,69 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module BooleanModule - module Models - # - # Model object. - # - class Error - # @return [Integer] - attr_accessor :status - - # @return [String] - attr_accessor :message - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.status - output_object['status'] = serialized_property unless serialized_property.nil? - - serialized_property = object.message - output_object['message'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Error] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Error.new - - deserialized_property = object['status'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.status = deserialized_property - - deserialized_property = object['message'] - output_object.message = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/byte/body_byte.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/byte/body_byte.rb deleted file mode 100644 index b8f7e3b6c..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/byte/body_byte.rb +++ /dev/null @@ -1,31 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -require 'uri' -require 'cgi' -require 'date' -require 'json' -require 'base64' -require 'erb' -require 'securerandom' -require 'time' -require 'timeliness' -require 'faraday' -require 'faraday-cookie_jar' -require 'concurrent' -require 'ms_rest' - -module ByteModule - autoload :Byte, 'body_byte/byte.rb' - autoload :AutoRestSwaggerBATByteService, 'body_byte/auto_rest_swagger_batbyte_service.rb' - - module Models - autoload :Error, 'body_byte/models/error.rb' - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/byte/body_byte/auto_rest_swagger_batbyte_service.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/byte/body_byte/auto_rest_swagger_batbyte_service.rb deleted file mode 100644 index c43869877..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/byte/body_byte/auto_rest_swagger_batbyte_service.rb +++ /dev/null @@ -1,41 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ByteModule - # - # A service client - single point of access to the REST API. - # - class AutoRestSwaggerBATByteService < MsRest::ServiceClient - include ByteModule::Models - - # @return [String] the base URI of the service. - attr_accessor :base_url - - # @return byte - attr_reader :byte - - # - # Creates initializes a new instance of the AutoRestSwaggerBATByteService class. - # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. - # @param base_url [String] the base URI of the service. - # @param options [Array] filters to be applied to the HTTP requests. - # - def initialize(credentials, base_url = nil, options = nil) - super(credentials, options) - @base_url = base_url || 'http://localhost' - - fail ArgumentError, 'credentials is nil' if credentials.nil? - fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) - @credentials = credentials - - @byte = Byte.new(self) - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/byte/body_byte/byte.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/byte/body_byte/byte.rb deleted file mode 100644 index 304b1f333..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/byte/body_byte/byte.rb +++ /dev/null @@ -1,353 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ByteModule - # - # Test Infrastructure for AutoRest Swagger BAT - # - class Byte - include ByteModule::Models - - # - # Creates and initializes a new instance of the Byte class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestSwaggerBATByteService - attr_reader :client - - # - # Get null byte value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_null(custom_headers = nil) - # Construct URL - path = "/byte/null" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = Base64.strict_decode64(parsed_response).unpack('C*') unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get empty byte value '' - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_empty(custom_headers = nil) - # Construct URL - path = "/byte/empty" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = Base64.strict_decode64(parsed_response).unpack('C*') unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6) - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_non_ascii(custom_headers = nil) - # Construct URL - path = "/byte/nonAscii" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = Base64.strict_decode64(parsed_response).unpack('C*') unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6) - # - # @param byte_body [Array] Base64-encoded non-ascii byte string - # hex(FF FE FD FC FB FA F9 F8 F7 F6) - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_non_ascii(byte_body, custom_headers = nil) - fail ArgumentError, 'byte_body is nil' if byte_body.nil? - # Construct URL - path = "/byte/nonAscii" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - byte_body = Base64.strict_encode64(byte_body.pack('c*')) - request_content = JSON.generate(byte_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get invalid byte value ':::SWAGGER::::' - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_invalid(custom_headers = nil) - # Construct URL - path = "/byte/invalid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = Base64.strict_decode64(parsed_response).unpack('C*') unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/byte/body_byte/models/error.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/byte/body_byte/models/error.rb deleted file mode 100644 index d35bfa7e2..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/byte/body_byte/models/error.rb +++ /dev/null @@ -1,69 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ByteModule - module Models - # - # Model object. - # - class Error - # @return [Integer] - attr_accessor :status - - # @return [String] - attr_accessor :message - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.status - output_object['status'] = serialized_property unless serialized_property.nil? - - serialized_property = object.message - output_object['message'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Error] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Error.new - - deserialized_property = object['status'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.status = deserialized_property - - deserialized_property = object['message'] - output_object.message = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex.rb deleted file mode 100644 index fe6d0b187..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex.rb +++ /dev/null @@ -1,62 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -require 'uri' -require 'cgi' -require 'date' -require 'json' -require 'base64' -require 'erb' -require 'securerandom' -require 'time' -require 'timeliness' -require 'faraday' -require 'faraday-cookie_jar' -require 'concurrent' -require 'ms_rest' - -module ComplexModule - autoload :BasicOperations, 'body_complex/basic_operations.rb' - autoload :Primitive, 'body_complex/primitive.rb' - autoload :Array, 'body_complex/array.rb' - autoload :Dictionary, 'body_complex/dictionary.rb' - autoload :Inheritance, 'body_complex/inheritance.rb' - autoload :Polymorphism, 'body_complex/polymorphism.rb' - autoload :Polymorphicrecursive, 'body_complex/polymorphicrecursive.rb' - autoload :AutoRestComplexTestService, 'body_complex/auto_rest_complex_test_service.rb' - - module Models - autoload :Error, 'body_complex/models/error.rb' - autoload :Basic, 'body_complex/models/basic.rb' - autoload :Pet, 'body_complex/models/pet.rb' - autoload :Fish, 'body_complex/models/fish.rb' - autoload :IntWrapper, 'body_complex/models/int_wrapper.rb' - autoload :LongWrapper, 'body_complex/models/long_wrapper.rb' - autoload :FloatWrapper, 'body_complex/models/float_wrapper.rb' - autoload :DoubleWrapper, 'body_complex/models/double_wrapper.rb' - autoload :BooleanWrapper, 'body_complex/models/boolean_wrapper.rb' - autoload :StringWrapper, 'body_complex/models/string_wrapper.rb' - autoload :DateWrapper, 'body_complex/models/date_wrapper.rb' - autoload :DatetimeWrapper, 'body_complex/models/datetime_wrapper.rb' - autoload :Datetimerfc1123Wrapper, 'body_complex/models/datetimerfc1123wrapper.rb' - autoload :DurationWrapper, 'body_complex/models/duration_wrapper.rb' - autoload :ByteWrapper, 'body_complex/models/byte_wrapper.rb' - autoload :ArrayWrapper, 'body_complex/models/array_wrapper.rb' - autoload :DictionaryWrapper, 'body_complex/models/dictionary_wrapper.rb' - autoload :Cat, 'body_complex/models/cat.rb' - autoload :Dog, 'body_complex/models/dog.rb' - autoload :Salmon, 'body_complex/models/salmon.rb' - autoload :Shark, 'body_complex/models/shark.rb' - autoload :Siamese, 'body_complex/models/siamese.rb' - autoload :Sawshark, 'body_complex/models/sawshark.rb' - autoload :Goblinshark, 'body_complex/models/goblinshark.rb' - autoload :Cookiecuttershark, 'body_complex/models/cookiecuttershark.rb' - autoload :CMYKColors, 'body_complex/models/cmykcolors.rb' - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/array.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/array.rb deleted file mode 100644 index 881e7a763..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/array.rb +++ /dev/null @@ -1,364 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - # - # Test Infrastructure for AutoRest - # - class Array - include ComplexModule::Models - - # - # Creates and initializes a new instance of the Array class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestComplexTestService - attr_reader :client - - # - # Get complex types with array property - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_valid(custom_headers = nil) - # Construct URL - path = "/complex/array/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = ArrayWrapper.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put complex types with array property - # - # @param complex_body [ArrayWrapper] Please put an array with 4 items: "1, 2, - # 3, 4", "", null, "&S#$(*Y", "The quick brown fox jumps over the lazy dog" - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_valid(complex_body, custom_headers = nil) - fail ArgumentError, 'complex_body is nil' if complex_body.nil? - complex_body.validate unless complex_body.nil? - # Construct URL - path = "/complex/array/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless complex_body.nil? - complex_body = ArrayWrapper.serialize_object(complex_body) - end - request_content = JSON.generate(complex_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get complex types with array property which is empty - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_empty(custom_headers = nil) - # Construct URL - path = "/complex/array/empty" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = ArrayWrapper.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put complex types with array property which is empty - # - # @param complex_body [ArrayWrapper] Please put an empty array - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_empty(complex_body, custom_headers = nil) - fail ArgumentError, 'complex_body is nil' if complex_body.nil? - complex_body.validate unless complex_body.nil? - # Construct URL - path = "/complex/array/empty" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless complex_body.nil? - complex_body = ArrayWrapper.serialize_object(complex_body) - end - request_content = JSON.generate(complex_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get complex types with array property while server doesn't provide a - # response payload - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_not_provided(custom_headers = nil) - # Construct URL - path = "/complex/array/notprovided" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = ArrayWrapper.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/auto_rest_complex_test_service.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/auto_rest_complex_test_service.rb deleted file mode 100644 index 3f1cdcff8..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/auto_rest_complex_test_service.rb +++ /dev/null @@ -1,65 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - # - # A service client - single point of access to the REST API. - # - class AutoRestComplexTestService < MsRest::ServiceClient - include ComplexModule::Models - - # @return [String] the base URI of the service. - attr_accessor :base_url - - # @return basic_operations - attr_reader :basic_operations - - # @return primitive - attr_reader :primitive - - # @return array - attr_reader :array - - # @return dictionary - attr_reader :dictionary - - # @return inheritance - attr_reader :inheritance - - # @return polymorphism - attr_reader :polymorphism - - # @return polymorphicrecursive - attr_reader :polymorphicrecursive - - # - # Creates initializes a new instance of the AutoRestComplexTestService class. - # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. - # @param base_url [String] the base URI of the service. - # @param options [Array] filters to be applied to the HTTP requests. - # - def initialize(credentials, base_url = nil, options = nil) - super(credentials, options) - @base_url = base_url || 'http://localhost' - - fail ArgumentError, 'credentials is nil' if credentials.nil? - fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) - @credentials = credentials - - @basic_operations = BasicOperations.new(self) - @primitive = Primitive.new(self) - @array = Array.new(self) - @dictionary = Dictionary.new(self) - @inheritance = Inheritance.new(self) - @polymorphism = Polymorphism.new(self) - @polymorphicrecursive = Polymorphicrecursive.new(self) - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/basic_operations.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/basic_operations.rb deleted file mode 100644 index 6dce9f198..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/basic_operations.rb +++ /dev/null @@ -1,430 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - # - # Test Infrastructure for AutoRest - # - class BasicOperations - include ComplexModule::Models - - # - # Creates and initializes a new instance of the BasicOperations class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestComplexTestService - attr_reader :client - - # - # Get complex type {id: 2, name: 'abc', color: 'YELLOW'} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_valid(custom_headers = nil) - # Construct URL - path = "/complex/basic/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Basic.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Please put {id: 2, name: 'abc', color: 'Magenta'} - # - # @param complex_body [Basic] Please put {id: 2, name: 'abc', color: 'Magenta'} - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_valid(complex_body, custom_headers = nil) - fail ArgumentError, 'complex_body is nil' if complex_body.nil? - complex_body.validate unless complex_body.nil? - # Construct URL - path = "/complex/basic/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless complex_body.nil? - complex_body = Basic.serialize_object(complex_body) - end - request_content = JSON.generate(complex_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get a basic complex type that is invalid for the local strong type - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_invalid(custom_headers = nil) - # Construct URL - path = "/complex/basic/invalid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Basic.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get a basic complex type that is empty - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_empty(custom_headers = nil) - # Construct URL - path = "/complex/basic/empty" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Basic.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get a basic complex type whose properties are null - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_null(custom_headers = nil) - # Construct URL - path = "/complex/basic/null" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Basic.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get a basic complex type while the server doesn't provide a response payload - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_not_provided(custom_headers = nil) - # Construct URL - path = "/complex/basic/notprovided" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Basic.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/dictionary.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/dictionary.rb deleted file mode 100644 index 8c5e52b7d..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/dictionary.rb +++ /dev/null @@ -1,432 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - # - # Test Infrastructure for AutoRest - # - class Dictionary - include ComplexModule::Models - - # - # Creates and initializes a new instance of the Dictionary class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestComplexTestService - attr_reader :client - - # - # Get complex types with dictionary property - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_valid(custom_headers = nil) - # Construct URL - path = "/complex/dictionary/typed/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = DictionaryWrapper.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put complex types with dictionary property - # - # @param complex_body [DictionaryWrapper] Please put a dictionary with 5 - # key-value pairs: "txt":"notepad", "bmp":"mspaint", "xls":"excel", "exe":"", - # "":null - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_valid(complex_body, custom_headers = nil) - fail ArgumentError, 'complex_body is nil' if complex_body.nil? - complex_body.validate unless complex_body.nil? - # Construct URL - path = "/complex/dictionary/typed/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless complex_body.nil? - complex_body = DictionaryWrapper.serialize_object(complex_body) - end - request_content = JSON.generate(complex_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get complex types with dictionary property which is empty - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_empty(custom_headers = nil) - # Construct URL - path = "/complex/dictionary/typed/empty" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = DictionaryWrapper.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put complex types with dictionary property which is empty - # - # @param complex_body [DictionaryWrapper] Please put an empty dictionary - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_empty(complex_body, custom_headers = nil) - fail ArgumentError, 'complex_body is nil' if complex_body.nil? - complex_body.validate unless complex_body.nil? - # Construct URL - path = "/complex/dictionary/typed/empty" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless complex_body.nil? - complex_body = DictionaryWrapper.serialize_object(complex_body) - end - request_content = JSON.generate(complex_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get complex types with dictionary property which is null - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_null(custom_headers = nil) - # Construct URL - path = "/complex/dictionary/typed/null" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = DictionaryWrapper.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get complex types with dictionary property while server doesn't provide a - # response payload - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_not_provided(custom_headers = nil) - # Construct URL - path = "/complex/dictionary/typed/notprovided" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = DictionaryWrapper.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/inheritance.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/inheritance.rb deleted file mode 100644 index 97ab4fee5..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/inheritance.rb +++ /dev/null @@ -1,165 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - # - # Test Infrastructure for AutoRest - # - class Inheritance - include ComplexModule::Models - - # - # Creates and initializes a new instance of the Inheritance class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestComplexTestService - attr_reader :client - - # - # Get complex types that extend others - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_valid(custom_headers = nil) - # Construct URL - path = "/complex/inheritance/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Siamese.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put complex types that extend others - # - # @param complex_body [Siamese] Please put a siamese with id=2, - # name="Siameee", color=green, breed=persion, which hates 2 dogs, the 1st one - # named "Potato" with id=1 and food="tomato", and the 2nd one named "Tomato" - # with id=-1 and food="french fries". - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_valid(complex_body, custom_headers = nil) - fail ArgumentError, 'complex_body is nil' if complex_body.nil? - complex_body.validate unless complex_body.nil? - # Construct URL - path = "/complex/inheritance/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless complex_body.nil? - complex_body = Siamese.serialize_object(complex_body) - end - request_content = JSON.generate(complex_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/array_wrapper.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/array_wrapper.rb deleted file mode 100644 index f82a38968..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/array_wrapper.rb +++ /dev/null @@ -1,59 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - module Models - # - # Model object. - # - class ArrayWrapper - # @return [Array] - attr_accessor :array - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - @array.each{ |e| e.validate if e.respond_to?(:validate) } unless @array.nil? - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.array - output_object['array'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [ArrayWrapper] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = ArrayWrapper.new - - deserialized_property = object['array'] - output_object.array = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/basic.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/basic.rb deleted file mode 100644 index 7e4d6a33c..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/basic.rb +++ /dev/null @@ -1,82 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - module Models - # - # Model object. - # - class Basic - # @return [Integer] - attr_accessor :id - - # @return [String] - attr_accessor :name - - # @return [CMYKColors] Possible values for this property include: - # 'cyan', 'Magenta', 'YELLOW', 'blacK'. - attr_accessor :color - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.id - output_object['id'] = serialized_property unless serialized_property.nil? - - serialized_property = object.name - output_object['name'] = serialized_property unless serialized_property.nil? - - serialized_property = object.color - output_object['color'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Basic] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Basic.new - - deserialized_property = object['id'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.id = deserialized_property - - deserialized_property = object['name'] - output_object.name = deserialized_property - - deserialized_property = object['color'] - if (!deserialized_property.nil? && !deserialized_property.empty?) - enum_is_valid = CMYKColors.constants.any? { |e| CMYKColors.const_get(e).to_s.downcase == deserialized_property.downcase } - fail MsRest::DeserializationError.new('Error occured while deserializing the enum', nil, nil, nil) unless enum_is_valid - end - output_object.color = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/boolean_wrapper.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/boolean_wrapper.rb deleted file mode 100644 index 7162334ab..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/boolean_wrapper.rb +++ /dev/null @@ -1,68 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - module Models - # - # Model object. - # - class BooleanWrapper - # @return [Boolean] - attr_accessor :field_true - - # @return [Boolean] - attr_accessor :field_false - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.field_true - output_object['field_true'] = serialized_property unless serialized_property.nil? - - serialized_property = object.field_false - output_object['field_false'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [BooleanWrapper] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = BooleanWrapper.new - - deserialized_property = object['field_true'] - output_object.field_true = deserialized_property - - deserialized_property = object['field_false'] - output_object.field_false = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/byte_wrapper.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/byte_wrapper.rb deleted file mode 100644 index abd0f8856..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/byte_wrapper.rb +++ /dev/null @@ -1,61 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - module Models - # - # Model object. - # - class ByteWrapper - # @return [Array] - attr_accessor :field - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.field - serialized_property = Base64.strict_encode64(serialized_property.pack('c*')) - output_object['field'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [ByteWrapper] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = ByteWrapper.new - - deserialized_property = object['field'] - deserialized_property = Base64.strict_decode64(deserialized_property).unpack('C*') unless deserialized_property.to_s.empty? - output_object.field = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/cat.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/cat.rb deleted file mode 100644 index 699cf503e..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/cat.rb +++ /dev/null @@ -1,101 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - module Models - # - # Model object. - # - class Cat < Pet - # @return [String] - attr_accessor :color - - # @return [Array] - attr_accessor :hates - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - @hates.each{ |e| e.validate if e.respond_to?(:validate) } unless @hates.nil? - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.id - output_object['id'] = serialized_property unless serialized_property.nil? - - serialized_property = object.name - output_object['name'] = serialized_property unless serialized_property.nil? - - serialized_property = object.color - output_object['color'] = serialized_property unless serialized_property.nil? - - serialized_property = object.hates - unless serialized_property.nil? - serializedArray = [] - serialized_property.each do |element| - unless element.nil? - element = Dog.serialize_object(element) - end - serializedArray.push(element) - end - serialized_property = serializedArray - end - output_object['hates'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Cat] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Cat.new - - deserialized_property = object['id'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.id = deserialized_property - - deserialized_property = object['name'] - output_object.name = deserialized_property - - deserialized_property = object['color'] - output_object.color = deserialized_property - - deserialized_property = object['hates'] - unless deserialized_property.nil? - deserializedArray = []; - deserialized_property.each do |element1| - unless element1.nil? - element1 = Dog.deserialize_object(element1) - end - deserializedArray.push(element1); - end - deserialized_property = deserializedArray; - end - output_object.hates = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/cmykcolors.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/cmykcolors.rb deleted file mode 100644 index 7e4c78d18..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/cmykcolors.rb +++ /dev/null @@ -1,22 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - module Models - # - # Defines values for CMYKColors - # - module CMYKColors - Cyan = "cyan" - Magenta = "Magenta" - YELLOW = "YELLOW" - BlacK = "blacK" - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/cookiecuttershark.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/cookiecuttershark.rb deleted file mode 100644 index 4f6ac27cb..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/cookiecuttershark.rb +++ /dev/null @@ -1,126 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - module Models - # - # Model object. - # - class Cookiecuttershark < Shark - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - unless object.fishtype.nil? or object.fishtype == "cookiecuttershark" - class_name = @@discriminatorMap[object.fishtype].capitalize - class_instance = Models.const_get(class_name) - output_object = class_instance.serialize_object(object) - else - output_object['fishtype'] = object.fishtype - end - - serialized_property = object.length - output_object['length'] = serialized_property unless serialized_property.nil? - - serialized_property = object.birthday - serialized_property = serialized_property.new_offset(0).strftime('%FT%TZ') - output_object['birthday'] = serialized_property unless serialized_property.nil? - - serialized_property = object.species - output_object['species'] = serialized_property unless serialized_property.nil? - - serialized_property = object.siblings - unless serialized_property.nil? - serializedArray = [] - serialized_property.each do |element| - unless element.nil? - element = Fish.serialize_object(element) - end - serializedArray.push(element) - end - serialized_property = serializedArray - end - output_object['siblings'] = serialized_property unless serialized_property.nil? - - serialized_property = object.age - output_object['age'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Cookiecuttershark] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Cookiecuttershark.new - - unless object['fishtype'].nil? or object['fishtype'] == "cookiecuttershark" - class_name = @@discriminatorMap[object['fishtype']].capitalize - class_instance = Models.const_get(class_name) - output_object = class_instance.deserialize_object(object) - else - output_object.fishtype = object['fishtype'] - end - - deserialized_property = object['length'] - deserialized_property = Float(deserialized_property) unless deserialized_property.to_s.empty? - output_object.length = deserialized_property - - deserialized_property = object['birthday'] - deserialized_property = DateTime.parse(deserialized_property) unless deserialized_property.to_s.empty? - output_object.birthday = deserialized_property - - deserialized_property = object['species'] - output_object.species = deserialized_property - - deserialized_property = object['siblings'] - unless deserialized_property.nil? - deserializedArray = []; - deserialized_property.each do |element1| - unless element1.nil? - element1 = Fish.deserialize_object(element1) - end - deserializedArray.push(element1); - end - deserialized_property = deserializedArray; - end - output_object.siblings = deserialized_property - - deserialized_property = object['age'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.age = deserialized_property - - output_object.validate - - output_object - end - - def initialize - @fishtype = "cookiecuttershark" - end - - attr_accessor :fishtype - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/date_wrapper.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/date_wrapper.rb deleted file mode 100644 index ce0c58a7e..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/date_wrapper.rb +++ /dev/null @@ -1,70 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - module Models - # - # Model object. - # - class DateWrapper - # @return [Date] - attr_accessor :field - - # @return [Date] - attr_accessor :leap - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.field - output_object['field'] = serialized_property unless serialized_property.nil? - - serialized_property = object.leap - output_object['leap'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [DateWrapper] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = DateWrapper.new - - deserialized_property = object['field'] - deserialized_property = MsRest::Serialization.deserialize_date(deserialized_property) unless deserialized_property.to_s.empty? - output_object.field = deserialized_property - - deserialized_property = object['leap'] - deserialized_property = MsRest::Serialization.deserialize_date(deserialized_property) unless deserialized_property.to_s.empty? - output_object.leap = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/datetime_wrapper.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/datetime_wrapper.rb deleted file mode 100644 index d779a3f4b..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/datetime_wrapper.rb +++ /dev/null @@ -1,72 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - module Models - # - # Model object. - # - class DatetimeWrapper - # @return [DateTime] - attr_accessor :field - - # @return [DateTime] - attr_accessor :now - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.field - serialized_property = serialized_property.new_offset(0).strftime('%FT%TZ') - output_object['field'] = serialized_property unless serialized_property.nil? - - serialized_property = object.now - serialized_property = serialized_property.new_offset(0).strftime('%FT%TZ') - output_object['now'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [DatetimeWrapper] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = DatetimeWrapper.new - - deserialized_property = object['field'] - deserialized_property = DateTime.parse(deserialized_property) unless deserialized_property.to_s.empty? - output_object.field = deserialized_property - - deserialized_property = object['now'] - deserialized_property = DateTime.parse(deserialized_property) unless deserialized_property.to_s.empty? - output_object.now = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/datetimerfc1123wrapper.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/datetimerfc1123wrapper.rb deleted file mode 100644 index 070b5b704..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/datetimerfc1123wrapper.rb +++ /dev/null @@ -1,72 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - module Models - # - # Model object. - # - class Datetimerfc1123Wrapper - # @return [DateTime] - attr_accessor :field - - # @return [DateTime] - attr_accessor :now - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.field - serialized_property = serialized_property.new_offset(0).strftime('%a, %d %b %Y %H:%M:%S GMT') - output_object['field'] = serialized_property unless serialized_property.nil? - - serialized_property = object.now - serialized_property = serialized_property.new_offset(0).strftime('%a, %d %b %Y %H:%M:%S GMT') - output_object['now'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Datetimerfc1123Wrapper] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Datetimerfc1123Wrapper.new - - deserialized_property = object['field'] - deserialized_property = DateTime.parse(deserialized_property) unless deserialized_property.to_s.empty? - output_object.field = deserialized_property - - deserialized_property = object['now'] - deserialized_property = DateTime.parse(deserialized_property) unless deserialized_property.to_s.empty? - output_object.now = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/dictionary_wrapper.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/dictionary_wrapper.rb deleted file mode 100644 index e81e6dc8a..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/dictionary_wrapper.rb +++ /dev/null @@ -1,59 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - module Models - # - # Model object. - # - class DictionaryWrapper - # @return [Hash{String => String}] - attr_accessor :default_program - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - @default_program.each{ |e| e.validate if e.respond_to?(:validate) } unless @default_program.nil? - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.default_program - output_object['defaultProgram'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [DictionaryWrapper] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = DictionaryWrapper.new - - deserialized_property = object['defaultProgram'] - output_object.default_program = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/dog.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/dog.rb deleted file mode 100644 index 13f84dbd3..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/dog.rb +++ /dev/null @@ -1,72 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - module Models - # - # Model object. - # - class Dog < Pet - # @return [String] - attr_accessor :food - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.id - output_object['id'] = serialized_property unless serialized_property.nil? - - serialized_property = object.name - output_object['name'] = serialized_property unless serialized_property.nil? - - serialized_property = object.food - output_object['food'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Dog] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Dog.new - - deserialized_property = object['id'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.id = deserialized_property - - deserialized_property = object['name'] - output_object.name = deserialized_property - - deserialized_property = object['food'] - output_object.food = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/double_wrapper.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/double_wrapper.rb deleted file mode 100644 index 83adefe3f..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/double_wrapper.rb +++ /dev/null @@ -1,70 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - module Models - # - # Model object. - # - class DoubleWrapper - # @return [Float] - attr_accessor :field1 - - # @return [Float] - attr_accessor :field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.field1 - output_object['field1'] = serialized_property unless serialized_property.nil? - - serialized_property = object.field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose - output_object['field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [DoubleWrapper] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = DoubleWrapper.new - - deserialized_property = object['field1'] - deserialized_property = Float(deserialized_property) unless deserialized_property.to_s.empty? - output_object.field1 = deserialized_property - - deserialized_property = object['field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose'] - deserialized_property = Float(deserialized_property) unless deserialized_property.to_s.empty? - output_object.field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/duration_wrapper.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/duration_wrapper.rb deleted file mode 100644 index e96a70806..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/duration_wrapper.rb +++ /dev/null @@ -1,59 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - module Models - # - # Model object. - # - class DurationWrapper - # @return [Duration] - attr_accessor :field - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.field - output_object['field'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [DurationWrapper] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = DurationWrapper.new - - deserialized_property = object['field'] - output_object.field = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/error.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/error.rb deleted file mode 100644 index 00ee55e6f..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/error.rb +++ /dev/null @@ -1,69 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - module Models - # - # Model object. - # - class Error - # @return [Integer] - attr_accessor :status - - # @return [String] - attr_accessor :message - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.status - output_object['status'] = serialized_property unless serialized_property.nil? - - serialized_property = object.message - output_object['message'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Error] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Error.new - - deserialized_property = object['status'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.status = deserialized_property - - deserialized_property = object['message'] - output_object.message = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/fish.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/fish.rb deleted file mode 100644 index 505a07521..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/fish.rb +++ /dev/null @@ -1,128 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - module Models - # - # Model object. - # - class Fish - @@discriminatorMap = Hash.new - @@discriminatorMap["Fish"] = "fish" - @@discriminatorMap["salmon"] = "salmon" - @@discriminatorMap["shark"] = "shark" - @@discriminatorMap["sawshark"] = "sawshark" - @@discriminatorMap["goblin"] = "goblinshark" - @@discriminatorMap["cookiecuttershark"] = "cookiecuttershark" - # @return [String] - attr_accessor :species - - # @return [Float] - attr_accessor :length - - # @return [Array] - attr_accessor :siblings - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - fail MsRest::ValidationError, 'property length is nil' if @length.nil? - @siblings.each{ |e| e.validate if e.respond_to?(:validate) } unless @siblings.nil? - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - unless object.fishtype.nil? or object.fishtype == "Fish" - class_name = @@discriminatorMap[object.fishtype].capitalize - class_instance = Models.const_get(class_name) - output_object = class_instance.serialize_object(object) - else - output_object['fishtype'] = object.fishtype - end - - serialized_property = object.length - output_object['length'] = serialized_property unless serialized_property.nil? - - serialized_property = object.species - output_object['species'] = serialized_property unless serialized_property.nil? - - serialized_property = object.siblings - unless serialized_property.nil? - serializedArray = [] - serialized_property.each do |element| - unless element.nil? - element = Fish.serialize_object(element) - end - serializedArray.push(element) - end - serialized_property = serializedArray - end - output_object['siblings'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Fish] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Fish.new - - unless object['fishtype'].nil? or object['fishtype'] == "Fish" - class_name = @@discriminatorMap[object['fishtype']].capitalize - class_instance = Models.const_get(class_name) - output_object = class_instance.deserialize_object(object) - else - output_object.fishtype = object['fishtype'] - end - - deserialized_property = object['length'] - deserialized_property = Float(deserialized_property) unless deserialized_property.to_s.empty? - output_object.length = deserialized_property - - deserialized_property = object['species'] - output_object.species = deserialized_property - - deserialized_property = object['siblings'] - unless deserialized_property.nil? - deserializedArray = []; - deserialized_property.each do |element1| - unless element1.nil? - element1 = Fish.deserialize_object(element1) - end - deserializedArray.push(element1); - end - deserialized_property = deserializedArray; - end - output_object.siblings = deserialized_property - - output_object.validate - - output_object - end - - def initialize - @fishtype = "Fish" - end - - attr_accessor :fishtype - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/float_wrapper.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/float_wrapper.rb deleted file mode 100644 index 95a621d52..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/float_wrapper.rb +++ /dev/null @@ -1,70 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - module Models - # - # Model object. - # - class FloatWrapper - # @return [Float] - attr_accessor :field1 - - # @return [Float] - attr_accessor :field2 - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.field1 - output_object['field1'] = serialized_property unless serialized_property.nil? - - serialized_property = object.field2 - output_object['field2'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [FloatWrapper] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = FloatWrapper.new - - deserialized_property = object['field1'] - deserialized_property = Float(deserialized_property) unless deserialized_property.to_s.empty? - output_object.field1 = deserialized_property - - deserialized_property = object['field2'] - deserialized_property = Float(deserialized_property) unless deserialized_property.to_s.empty? - output_object.field2 = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/goblinshark.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/goblinshark.rb deleted file mode 100644 index 0b0801cc5..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/goblinshark.rb +++ /dev/null @@ -1,136 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - module Models - # - # Model object. - # - class Goblinshark < Shark - # @return [Integer] - attr_accessor :jawsize - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - unless object.fishtype.nil? or object.fishtype == "goblin" - class_name = @@discriminatorMap[object.fishtype].capitalize - class_instance = Models.const_get(class_name) - output_object = class_instance.serialize_object(object) - else - output_object['fishtype'] = object.fishtype - end - - serialized_property = object.length - output_object['length'] = serialized_property unless serialized_property.nil? - - serialized_property = object.birthday - serialized_property = serialized_property.new_offset(0).strftime('%FT%TZ') - output_object['birthday'] = serialized_property unless serialized_property.nil? - - serialized_property = object.species - output_object['species'] = serialized_property unless serialized_property.nil? - - serialized_property = object.siblings - unless serialized_property.nil? - serializedArray = [] - serialized_property.each do |element| - unless element.nil? - element = Fish.serialize_object(element) - end - serializedArray.push(element) - end - serialized_property = serializedArray - end - output_object['siblings'] = serialized_property unless serialized_property.nil? - - serialized_property = object.age - output_object['age'] = serialized_property unless serialized_property.nil? - - serialized_property = object.jawsize - output_object['jawsize'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Goblinshark] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Goblinshark.new - - unless object['fishtype'].nil? or object['fishtype'] == "goblin" - class_name = @@discriminatorMap[object['fishtype']].capitalize - class_instance = Models.const_get(class_name) - output_object = class_instance.deserialize_object(object) - else - output_object.fishtype = object['fishtype'] - end - - deserialized_property = object['length'] - deserialized_property = Float(deserialized_property) unless deserialized_property.to_s.empty? - output_object.length = deserialized_property - - deserialized_property = object['birthday'] - deserialized_property = DateTime.parse(deserialized_property) unless deserialized_property.to_s.empty? - output_object.birthday = deserialized_property - - deserialized_property = object['species'] - output_object.species = deserialized_property - - deserialized_property = object['siblings'] - unless deserialized_property.nil? - deserializedArray = []; - deserialized_property.each do |element1| - unless element1.nil? - element1 = Fish.deserialize_object(element1) - end - deserializedArray.push(element1); - end - deserialized_property = deserializedArray; - end - output_object.siblings = deserialized_property - - deserialized_property = object['age'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.age = deserialized_property - - deserialized_property = object['jawsize'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.jawsize = deserialized_property - - output_object.validate - - output_object - end - - def initialize - @fishtype = "goblin" - end - - attr_accessor :fishtype - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/int_wrapper.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/int_wrapper.rb deleted file mode 100644 index ffdbaf814..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/int_wrapper.rb +++ /dev/null @@ -1,70 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - module Models - # - # Model object. - # - class IntWrapper - # @return [Integer] - attr_accessor :field1 - - # @return [Integer] - attr_accessor :field2 - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.field1 - output_object['field1'] = serialized_property unless serialized_property.nil? - - serialized_property = object.field2 - output_object['field2'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [IntWrapper] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = IntWrapper.new - - deserialized_property = object['field1'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.field1 = deserialized_property - - deserialized_property = object['field2'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.field2 = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/long_wrapper.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/long_wrapper.rb deleted file mode 100644 index b7bb8783e..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/long_wrapper.rb +++ /dev/null @@ -1,70 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - module Models - # - # Model object. - # - class LongWrapper - # @return [Integer] - attr_accessor :field1 - - # @return [Integer] - attr_accessor :field2 - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.field1 - output_object['field1'] = serialized_property unless serialized_property.nil? - - serialized_property = object.field2 - output_object['field2'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [LongWrapper] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = LongWrapper.new - - deserialized_property = object['field1'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.field1 = deserialized_property - - deserialized_property = object['field2'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.field2 = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/pet.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/pet.rb deleted file mode 100644 index 519e63d38..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/pet.rb +++ /dev/null @@ -1,69 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - module Models - # - # Model object. - # - class Pet - # @return [Integer] - attr_accessor :id - - # @return [String] - attr_accessor :name - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.id - output_object['id'] = serialized_property unless serialized_property.nil? - - serialized_property = object.name - output_object['name'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Pet] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Pet.new - - deserialized_property = object['id'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.id = deserialized_property - - deserialized_property = object['name'] - output_object.name = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/salmon.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/salmon.rb deleted file mode 100644 index eac71aa82..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/salmon.rb +++ /dev/null @@ -1,129 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - module Models - # - # Model object. - # - class Salmon < Fish - # @return [String] - attr_accessor :location - - # @return [Boolean] - attr_accessor :iswild - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - unless object.fishtype.nil? or object.fishtype == "salmon" - class_name = @@discriminatorMap[object.fishtype].capitalize - class_instance = Models.const_get(class_name) - output_object = class_instance.serialize_object(object) - else - output_object['fishtype'] = object.fishtype - end - - serialized_property = object.length - output_object['length'] = serialized_property unless serialized_property.nil? - - serialized_property = object.species - output_object['species'] = serialized_property unless serialized_property.nil? - - serialized_property = object.siblings - unless serialized_property.nil? - serializedArray = [] - serialized_property.each do |element| - unless element.nil? - element = Fish.serialize_object(element) - end - serializedArray.push(element) - end - serialized_property = serializedArray - end - output_object['siblings'] = serialized_property unless serialized_property.nil? - - serialized_property = object.location - output_object['location'] = serialized_property unless serialized_property.nil? - - serialized_property = object.iswild - output_object['iswild'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Salmon] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Salmon.new - - unless object['fishtype'].nil? or object['fishtype'] == "salmon" - class_name = @@discriminatorMap[object['fishtype']].capitalize - class_instance = Models.const_get(class_name) - output_object = class_instance.deserialize_object(object) - else - output_object.fishtype = object['fishtype'] - end - - deserialized_property = object['length'] - deserialized_property = Float(deserialized_property) unless deserialized_property.to_s.empty? - output_object.length = deserialized_property - - deserialized_property = object['species'] - output_object.species = deserialized_property - - deserialized_property = object['siblings'] - unless deserialized_property.nil? - deserializedArray = []; - deserialized_property.each do |element1| - unless element1.nil? - element1 = Fish.deserialize_object(element1) - end - deserializedArray.push(element1); - end - deserialized_property = deserializedArray; - end - output_object.siblings = deserialized_property - - deserialized_property = object['location'] - output_object.location = deserialized_property - - deserialized_property = object['iswild'] - output_object.iswild = deserialized_property - - output_object.validate - - output_object - end - - def initialize - @fishtype = "salmon" - end - - attr_accessor :fishtype - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/sawshark.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/sawshark.rb deleted file mode 100644 index 67c2b6238..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/sawshark.rb +++ /dev/null @@ -1,137 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - module Models - # - # Model object. - # - class Sawshark < Shark - # @return [Array] - attr_accessor :picture - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - unless object.fishtype.nil? or object.fishtype == "sawshark" - class_name = @@discriminatorMap[object.fishtype].capitalize - class_instance = Models.const_get(class_name) - output_object = class_instance.serialize_object(object) - else - output_object['fishtype'] = object.fishtype - end - - serialized_property = object.length - output_object['length'] = serialized_property unless serialized_property.nil? - - serialized_property = object.birthday - serialized_property = serialized_property.new_offset(0).strftime('%FT%TZ') - output_object['birthday'] = serialized_property unless serialized_property.nil? - - serialized_property = object.species - output_object['species'] = serialized_property unless serialized_property.nil? - - serialized_property = object.siblings - unless serialized_property.nil? - serializedArray = [] - serialized_property.each do |element| - unless element.nil? - element = Fish.serialize_object(element) - end - serializedArray.push(element) - end - serialized_property = serializedArray - end - output_object['siblings'] = serialized_property unless serialized_property.nil? - - serialized_property = object.age - output_object['age'] = serialized_property unless serialized_property.nil? - - serialized_property = object.picture - serialized_property = Base64.strict_encode64(serialized_property.pack('c*')) - output_object['picture'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Sawshark] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Sawshark.new - - unless object['fishtype'].nil? or object['fishtype'] == "sawshark" - class_name = @@discriminatorMap[object['fishtype']].capitalize - class_instance = Models.const_get(class_name) - output_object = class_instance.deserialize_object(object) - else - output_object.fishtype = object['fishtype'] - end - - deserialized_property = object['length'] - deserialized_property = Float(deserialized_property) unless deserialized_property.to_s.empty? - output_object.length = deserialized_property - - deserialized_property = object['birthday'] - deserialized_property = DateTime.parse(deserialized_property) unless deserialized_property.to_s.empty? - output_object.birthday = deserialized_property - - deserialized_property = object['species'] - output_object.species = deserialized_property - - deserialized_property = object['siblings'] - unless deserialized_property.nil? - deserializedArray = []; - deserialized_property.each do |element1| - unless element1.nil? - element1 = Fish.deserialize_object(element1) - end - deserializedArray.push(element1); - end - deserialized_property = deserializedArray; - end - output_object.siblings = deserialized_property - - deserialized_property = object['age'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.age = deserialized_property - - deserialized_property = object['picture'] - deserialized_property = Base64.strict_decode64(deserialized_property).unpack('C*') unless deserialized_property.to_s.empty? - output_object.picture = deserialized_property - - output_object.validate - - output_object - end - - def initialize - @fishtype = "sawshark" - end - - attr_accessor :fishtype - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/shark.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/shark.rb deleted file mode 100644 index 913d47a6a..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/shark.rb +++ /dev/null @@ -1,132 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - module Models - # - # Model object. - # - class Shark < Fish - # @return [Integer] - attr_accessor :age - - # @return [DateTime] - attr_accessor :birthday - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - fail MsRest::ValidationError, 'property birthday is nil' if @birthday.nil? - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - unless object.fishtype.nil? or object.fishtype == "shark" - class_name = @@discriminatorMap[object.fishtype].capitalize - class_instance = Models.const_get(class_name) - output_object = class_instance.serialize_object(object) - else - output_object['fishtype'] = object.fishtype - end - - serialized_property = object.length - output_object['length'] = serialized_property unless serialized_property.nil? - - serialized_property = object.birthday - serialized_property = serialized_property.new_offset(0).strftime('%FT%TZ') - output_object['birthday'] = serialized_property unless serialized_property.nil? - - serialized_property = object.species - output_object['species'] = serialized_property unless serialized_property.nil? - - serialized_property = object.siblings - unless serialized_property.nil? - serializedArray = [] - serialized_property.each do |element| - unless element.nil? - element = Fish.serialize_object(element) - end - serializedArray.push(element) - end - serialized_property = serializedArray - end - output_object['siblings'] = serialized_property unless serialized_property.nil? - - serialized_property = object.age - output_object['age'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Shark] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Shark.new - - unless object['fishtype'].nil? or object['fishtype'] == "shark" - class_name = @@discriminatorMap[object['fishtype']].capitalize - class_instance = Models.const_get(class_name) - output_object = class_instance.deserialize_object(object) - else - output_object.fishtype = object['fishtype'] - end - - deserialized_property = object['length'] - deserialized_property = Float(deserialized_property) unless deserialized_property.to_s.empty? - output_object.length = deserialized_property - - deserialized_property = object['birthday'] - deserialized_property = DateTime.parse(deserialized_property) unless deserialized_property.to_s.empty? - output_object.birthday = deserialized_property - - deserialized_property = object['species'] - output_object.species = deserialized_property - - deserialized_property = object['siblings'] - unless deserialized_property.nil? - deserializedArray = []; - deserialized_property.each do |element1| - unless element1.nil? - element1 = Fish.deserialize_object(element1) - end - deserializedArray.push(element1); - end - deserialized_property = deserializedArray; - end - output_object.siblings = deserialized_property - - deserialized_property = object['age'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.age = deserialized_property - - output_object.validate - - output_object - end - - def initialize - @fishtype = "shark" - end - - attr_accessor :fishtype - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/siamese.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/siamese.rb deleted file mode 100644 index 9b09bb37c..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/siamese.rb +++ /dev/null @@ -1,104 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - module Models - # - # Model object. - # - class Siamese < Cat - # @return [String] - attr_accessor :breed - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.id - output_object['id'] = serialized_property unless serialized_property.nil? - - serialized_property = object.name - output_object['name'] = serialized_property unless serialized_property.nil? - - serialized_property = object.color - output_object['color'] = serialized_property unless serialized_property.nil? - - serialized_property = object.hates - unless serialized_property.nil? - serializedArray = [] - serialized_property.each do |element| - unless element.nil? - element = Dog.serialize_object(element) - end - serializedArray.push(element) - end - serialized_property = serializedArray - end - output_object['hates'] = serialized_property unless serialized_property.nil? - - serialized_property = object.breed - output_object['breed'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Siamese] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Siamese.new - - deserialized_property = object['id'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.id = deserialized_property - - deserialized_property = object['name'] - output_object.name = deserialized_property - - deserialized_property = object['color'] - output_object.color = deserialized_property - - deserialized_property = object['hates'] - unless deserialized_property.nil? - deserializedArray = []; - deserialized_property.each do |element1| - unless element1.nil? - element1 = Dog.deserialize_object(element1) - end - deserializedArray.push(element1); - end - deserialized_property = deserializedArray; - end - output_object.hates = deserialized_property - - deserialized_property = object['breed'] - output_object.breed = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/string_wrapper.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/string_wrapper.rb deleted file mode 100644 index d983fe1ea..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/models/string_wrapper.rb +++ /dev/null @@ -1,77 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - module Models - # - # Model object. - # - class StringWrapper - # @return [String] - attr_accessor :field - - # @return [String] - attr_accessor :empty - - # @return [String] - attr_accessor :null - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.field - output_object['field'] = serialized_property unless serialized_property.nil? - - serialized_property = object.empty - output_object['empty'] = serialized_property unless serialized_property.nil? - - serialized_property = object.null - output_object['null'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [StringWrapper] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = StringWrapper.new - - deserialized_property = object['field'] - output_object.field = deserialized_property - - deserialized_property = object['empty'] - output_object.empty = deserialized_property - - deserialized_property = object['null'] - output_object.null = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/polymorphicrecursive.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/polymorphicrecursive.rb deleted file mode 100644 index 26641b0ac..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/polymorphicrecursive.rb +++ /dev/null @@ -1,214 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - # - # Test Infrastructure for AutoRest - # - class Polymorphicrecursive - include ComplexModule::Models - - # - # Creates and initializes a new instance of the Polymorphicrecursive class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestComplexTestService - attr_reader :client - - # - # Get complex types that are polymorphic and have recursive references - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_valid(custom_headers = nil) - # Construct URL - path = "/complex/polymorphicrecursive/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Fish.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put complex types that are polymorphic and have recursive references - # - # @param complex_body [Fish] Please put a salmon that looks like this: - # { - # "fishtype": "salmon", - # "species": "king", - # "length": 1, - # "age": 1, - # "location": "alaska", - # "iswild": true, - # "siblings": [ - # { - # "fishtype": "shark", - # "species": "predator", - # "length": 20, - # "age": 6, - # "siblings": [ - # { - # "fishtype": "salmon", - # "species": "coho", - # "length": 2, - # "age": 2, - # "location": "atlantic", - # "iswild": true, - # "siblings": [ - # { - # "fishtype": "shark", - # "species": "predator", - # "length": 20, - # "age": 6 - # }, - # { - # "fishtype": "sawshark", - # "species": "dangerous", - # "length": 10, - # "age": 105 - # } - # ] - # }, - # { - # "fishtype": "sawshark", - # "species": "dangerous", - # "length": 10, - # "age": 105 - # } - # ] - # }, - # { - # "fishtype": "sawshark", - # "species": "dangerous", - # "length": 10, - # "age": 105 - # } - # ] - # } - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_valid(complex_body, custom_headers = nil) - fail ArgumentError, 'complex_body is nil' if complex_body.nil? - complex_body.validate unless complex_body.nil? - # Construct URL - path = "/complex/polymorphicrecursive/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless complex_body.nil? - complex_body = Fish.serialize_object(complex_body) - end - request_content = JSON.generate(complex_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/polymorphism.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/polymorphism.rb deleted file mode 100644 index ff1607ffa..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/polymorphism.rb +++ /dev/null @@ -1,288 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - # - # Test Infrastructure for AutoRest - # - class Polymorphism - include ComplexModule::Models - - # - # Creates and initializes a new instance of the Polymorphism class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestComplexTestService - attr_reader :client - - # - # Get complex types that are polymorphic - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_valid(custom_headers = nil) - # Construct URL - path = "/complex/polymorphism/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Fish.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put complex types that are polymorphic - # - # @param complex_body [Fish] Please put a salmon that looks like this: - # { - # 'fishtype':'Salmon', - # 'location':'alaska', - # 'iswild':true, - # 'species':'king', - # 'length':1.0, - # 'siblings':[ - # { - # 'fishtype':'Shark', - # 'age':6, - # 'birthday': '2012-01-05T01:00:00Z', - # 'length':20.0, - # 'species':'predator', - # }, - # { - # 'fishtype':'Sawshark', - # 'age':105, - # 'birthday': '1900-01-05T01:00:00Z', - # 'length':10.0, - # 'picture': new Buffer([255, 255, 255, 255, - # 254]).toString('base64'), - # 'species':'dangerous', - # }, - # { - # 'fishtype': 'goblin', - # 'age': 1, - # 'birthday': '2015-08-08T00:00:00Z', - # 'length': 30.0, - # 'species': 'scary', - # 'jawsize': 5 - # } - # ] - # }; - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_valid(complex_body, custom_headers = nil) - fail ArgumentError, 'complex_body is nil' if complex_body.nil? - complex_body.validate unless complex_body.nil? - # Construct URL - path = "/complex/polymorphism/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless complex_body.nil? - complex_body = Fish.serialize_object(complex_body) - end - request_content = JSON.generate(complex_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Put complex types that are polymorphic, attempting to omit required - # 'birthday' field - the request should not be allowed from the client - # - # @param complex_body [Fish] Please attempt put a sawshark that looks like - # this, the client should not allow this data to be sent: - # { - # "fishtype": "sawshark", - # "species": "snaggle toothed", - # "length": 18.5, - # "age": 2, - # "birthday": "2013-06-01T01:00:00Z", - # "location": "alaska", - # "picture": base64(FF FF FF FF FE), - # "siblings": [ - # { - # "fishtype": "shark", - # "species": "predator", - # "birthday": "2012-01-05T01:00:00Z", - # "length": 20, - # "age": 6 - # }, - # { - # "fishtype": "sawshark", - # "species": "dangerous", - # "picture": base64(FF FF FF FF FE), - # "length": 10, - # "age": 105 - # } - # ] - # } - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_valid_missing_required(complex_body, custom_headers = nil) - fail ArgumentError, 'complex_body is nil' if complex_body.nil? - complex_body.validate unless complex_body.nil? - # Construct URL - path = "/complex/polymorphism/missingrequired/invalid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless complex_body.nil? - complex_body = Fish.serialize_object(complex_body) - end - request_content = JSON.generate(complex_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/primitive.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/primitive.rb deleted file mode 100644 index 7cb449cba..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/complex/body_complex/primitive.rb +++ /dev/null @@ -1,1496 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ComplexModule - # - # Test Infrastructure for AutoRest - # - class Primitive - include ComplexModule::Models - - # - # Creates and initializes a new instance of the Primitive class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestComplexTestService - attr_reader :client - - # - # Get complex types with integer properties - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_int(custom_headers = nil) - # Construct URL - path = "/complex/primitive/integer" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = IntWrapper.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put complex types with integer properties - # - # @param complex_body [IntWrapper] Please put -1 and 2 - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_int(complex_body, custom_headers = nil) - fail ArgumentError, 'complex_body is nil' if complex_body.nil? - complex_body.validate unless complex_body.nil? - # Construct URL - path = "/complex/primitive/integer" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless complex_body.nil? - complex_body = IntWrapper.serialize_object(complex_body) - end - request_content = JSON.generate(complex_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get complex types with long properties - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_long(custom_headers = nil) - # Construct URL - path = "/complex/primitive/long" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = LongWrapper.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put complex types with long properties - # - # @param complex_body [LongWrapper] Please put 1099511627775 and -999511627788 - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_long(complex_body, custom_headers = nil) - fail ArgumentError, 'complex_body is nil' if complex_body.nil? - complex_body.validate unless complex_body.nil? - # Construct URL - path = "/complex/primitive/long" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless complex_body.nil? - complex_body = LongWrapper.serialize_object(complex_body) - end - request_content = JSON.generate(complex_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get complex types with float properties - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_float(custom_headers = nil) - # Construct URL - path = "/complex/primitive/float" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = FloatWrapper.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put complex types with float properties - # - # @param complex_body [FloatWrapper] Please put 1.05 and -0.003 - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_float(complex_body, custom_headers = nil) - fail ArgumentError, 'complex_body is nil' if complex_body.nil? - complex_body.validate unless complex_body.nil? - # Construct URL - path = "/complex/primitive/float" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless complex_body.nil? - complex_body = FloatWrapper.serialize_object(complex_body) - end - request_content = JSON.generate(complex_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get complex types with double properties - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_double(custom_headers = nil) - # Construct URL - path = "/complex/primitive/double" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = DoubleWrapper.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put complex types with double properties - # - # @param complex_body [DoubleWrapper] Please put 3e-100 and - # -0.000000000000000000000000000000000000000000000000000000005 - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_double(complex_body, custom_headers = nil) - fail ArgumentError, 'complex_body is nil' if complex_body.nil? - complex_body.validate unless complex_body.nil? - # Construct URL - path = "/complex/primitive/double" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless complex_body.nil? - complex_body = DoubleWrapper.serialize_object(complex_body) - end - request_content = JSON.generate(complex_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get complex types with bool properties - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_bool(custom_headers = nil) - # Construct URL - path = "/complex/primitive/bool" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = BooleanWrapper.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put complex types with bool properties - # - # @param complex_body [BooleanWrapper] Please put true and false - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_bool(complex_body, custom_headers = nil) - fail ArgumentError, 'complex_body is nil' if complex_body.nil? - complex_body.validate unless complex_body.nil? - # Construct URL - path = "/complex/primitive/bool" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless complex_body.nil? - complex_body = BooleanWrapper.serialize_object(complex_body) - end - request_content = JSON.generate(complex_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get complex types with string properties - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_string(custom_headers = nil) - # Construct URL - path = "/complex/primitive/string" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = StringWrapper.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put complex types with string properties - # - # @param complex_body [StringWrapper] Please put 'goodrequest', '', and null - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_string(complex_body, custom_headers = nil) - fail ArgumentError, 'complex_body is nil' if complex_body.nil? - complex_body.validate unless complex_body.nil? - # Construct URL - path = "/complex/primitive/string" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless complex_body.nil? - complex_body = StringWrapper.serialize_object(complex_body) - end - request_content = JSON.generate(complex_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get complex types with date properties - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_date(custom_headers = nil) - # Construct URL - path = "/complex/primitive/date" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = DateWrapper.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put complex types with date properties - # - # @param complex_body [DateWrapper] Please put '0001-01-01' and '2016-02-29' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_date(complex_body, custom_headers = nil) - fail ArgumentError, 'complex_body is nil' if complex_body.nil? - complex_body.validate unless complex_body.nil? - # Construct URL - path = "/complex/primitive/date" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless complex_body.nil? - complex_body = DateWrapper.serialize_object(complex_body) - end - request_content = JSON.generate(complex_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get complex types with datetime properties - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_date_time(custom_headers = nil) - # Construct URL - path = "/complex/primitive/datetime" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = DatetimeWrapper.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put complex types with datetime properties - # - # @param complex_body [DatetimeWrapper] Please put '0001-01-01T12:00:00-04:00' - # and '2015-05-18T11:38:00-08:00' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_date_time(complex_body, custom_headers = nil) - fail ArgumentError, 'complex_body is nil' if complex_body.nil? - complex_body.validate unless complex_body.nil? - # Construct URL - path = "/complex/primitive/datetime" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless complex_body.nil? - complex_body = DatetimeWrapper.serialize_object(complex_body) - end - request_content = JSON.generate(complex_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get complex types with datetimeRfc1123 properties - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_date_time_rfc1123(custom_headers = nil) - # Construct URL - path = "/complex/primitive/datetimerfc1123" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Datetimerfc1123Wrapper.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put complex types with datetimeRfc1123 properties - # - # @param complex_body [Datetimerfc1123Wrapper] Please put 'Mon, 01 Jan 0001 - # 12:00:00 GMT' and 'Mon, 18 May 2015 11:38:00 GMT' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_date_time_rfc1123(complex_body, custom_headers = nil) - fail ArgumentError, 'complex_body is nil' if complex_body.nil? - complex_body.validate unless complex_body.nil? - # Construct URL - path = "/complex/primitive/datetimerfc1123" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless complex_body.nil? - complex_body = Datetimerfc1123Wrapper.serialize_object(complex_body) - end - request_content = JSON.generate(complex_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get complex types with duration properties - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_duration(custom_headers = nil) - # Construct URL - path = "/complex/primitive/duration" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = DurationWrapper.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put complex types with duration properties - # - # @param complex_body [DurationWrapper] Please put 'P123DT22H14M12.011S' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_duration(complex_body, custom_headers = nil) - fail ArgumentError, 'complex_body is nil' if complex_body.nil? - complex_body.validate unless complex_body.nil? - # Construct URL - path = "/complex/primitive/duration" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless complex_body.nil? - complex_body = DurationWrapper.serialize_object(complex_body) - end - request_content = JSON.generate(complex_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get complex types with byte properties - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_byte(custom_headers = nil) - # Construct URL - path = "/complex/primitive/byte" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = ByteWrapper.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put complex types with byte properties - # - # @param complex_body [ByteWrapper] Please put non-ascii byte string hex(FF FE - # FD FC 00 FA F9 F8 F7 F6) - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_byte(complex_body, custom_headers = nil) - fail ArgumentError, 'complex_body is nil' if complex_body.nil? - complex_body.validate unless complex_body.nil? - # Construct URL - path = "/complex/primitive/byte" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless complex_body.nil? - complex_body = ByteWrapper.serialize_object(complex_body) - end - request_content = JSON.generate(complex_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/date/body_date.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/date/body_date.rb deleted file mode 100644 index 59ab59874..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/date/body_date.rb +++ /dev/null @@ -1,31 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -require 'uri' -require 'cgi' -require 'date' -require 'json' -require 'base64' -require 'erb' -require 'securerandom' -require 'time' -require 'timeliness' -require 'faraday' -require 'faraday-cookie_jar' -require 'concurrent' -require 'ms_rest' - -module DateModule - autoload :Date, 'body_date/date.rb' - autoload :AutoRestDateTestService, 'body_date/auto_rest_date_test_service.rb' - - module Models - autoload :Error, 'body_date/models/error.rb' - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/date/body_date/auto_rest_date_test_service.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/date/body_date/auto_rest_date_test_service.rb deleted file mode 100644 index 7d3e0ed71..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/date/body_date/auto_rest_date_test_service.rb +++ /dev/null @@ -1,41 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module DateModule - # - # A service client - single point of access to the REST API. - # - class AutoRestDateTestService < MsRest::ServiceClient - include DateModule::Models - - # @return [String] the base URI of the service. - attr_accessor :base_url - - # @return date - attr_reader :date - - # - # Creates initializes a new instance of the AutoRestDateTestService class. - # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. - # @param base_url [String] the base URI of the service. - # @param options [Array] filters to be applied to the HTTP requests. - # - def initialize(credentials, base_url = nil, options = nil) - super(credentials, options) - @base_url = base_url || 'https://localhost' - - fail ArgumentError, 'credentials is nil' if credentials.nil? - fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) - @credentials = credentials - - @date = Date.new(self) - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/date/body_date/date.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/date/body_date/date.rb deleted file mode 100644 index e995a3a6b..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/date/body_date/date.rb +++ /dev/null @@ -1,543 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module DateModule - # - # Test Infrastructure for AutoRest - # - class Date - include DateModule::Models - - # - # Creates and initializes a new instance of the Date class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestDateTestService - attr_reader :client - - # - # Get null date value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_null(custom_headers = nil) - # Construct URL - path = "/date/null" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = MsRest::Serialization.deserialize_date(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get invalid date value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_invalid_date(custom_headers = nil) - # Construct URL - path = "/date/invaliddate" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = MsRest::Serialization.deserialize_date(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get overflow date value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_overflow_date(custom_headers = nil) - # Construct URL - path = "/date/overflowdate" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = MsRest::Serialization.deserialize_date(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get underflow date value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_underflow_date(custom_headers = nil) - # Construct URL - path = "/date/underflowdate" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = MsRest::Serialization.deserialize_date(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put max date value 9999-12-31 - # - # @param date_body [Date] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_max_date(date_body, custom_headers = nil) - fail ArgumentError, 'date_body is nil' if date_body.nil? - # Construct URL - path = "/date/max" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(date_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get max date value 9999-12-31 - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_max_date(custom_headers = nil) - # Construct URL - path = "/date/max" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = MsRest::Serialization.deserialize_date(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put min date value 0000-01-01 - # - # @param date_body [Date] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_min_date(date_body, custom_headers = nil) - fail ArgumentError, 'date_body is nil' if date_body.nil? - # Construct URL - path = "/date/min" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(date_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get min date value 0000-01-01 - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_min_date(custom_headers = nil) - # Construct URL - path = "/date/min" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = MsRest::Serialization.deserialize_date(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/date/body_date/models/error.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/date/body_date/models/error.rb deleted file mode 100644 index d527419dd..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/date/body_date/models/error.rb +++ /dev/null @@ -1,69 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module DateModule - module Models - # - # Model object. - # - class Error - # @return [Integer] - attr_accessor :status - - # @return [String] - attr_accessor :message - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.status - output_object['status'] = serialized_property unless serialized_property.nil? - - serialized_property = object.message - output_object['message'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Error] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Error.new - - deserialized_property = object['status'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.status = deserialized_property - - deserialized_property = object['message'] - output_object.message = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/datetime/body_datetime.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/datetime/body_datetime.rb deleted file mode 100644 index bad076d08..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/datetime/body_datetime.rb +++ /dev/null @@ -1,31 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -require 'uri' -require 'cgi' -require 'date' -require 'json' -require 'base64' -require 'erb' -require 'securerandom' -require 'time' -require 'timeliness' -require 'faraday' -require 'faraday-cookie_jar' -require 'concurrent' -require 'ms_rest' - -module DatetimeModule - autoload :Datetime, 'body_datetime/datetime.rb' - autoload :AutoRestDateTimeTestService, 'body_datetime/auto_rest_date_time_test_service.rb' - - module Models - autoload :Error, 'body_datetime/models/error.rb' - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/datetime/body_datetime/auto_rest_date_time_test_service.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/datetime/body_datetime/auto_rest_date_time_test_service.rb deleted file mode 100644 index 89dca7445..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/datetime/body_datetime/auto_rest_date_time_test_service.rb +++ /dev/null @@ -1,41 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module DatetimeModule - # - # A service client - single point of access to the REST API. - # - class AutoRestDateTimeTestService < MsRest::ServiceClient - include DatetimeModule::Models - - # @return [String] the base URI of the service. - attr_accessor :base_url - - # @return datetime - attr_reader :datetime - - # - # Creates initializes a new instance of the AutoRestDateTimeTestService class. - # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. - # @param base_url [String] the base URI of the service. - # @param options [Array] filters to be applied to the HTTP requests. - # - def initialize(credentials, base_url = nil, options = nil) - super(credentials, options) - @base_url = base_url || 'https://localhost' - - fail ArgumentError, 'credentials is nil' if credentials.nil? - fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) - @credentials = credentials - - @datetime = Datetime.new(self) - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/datetime/body_datetime/datetime.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/datetime/body_datetime/datetime.rb deleted file mode 100644 index 35839b1ed..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/datetime/body_datetime/datetime.rb +++ /dev/null @@ -1,1258 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module DatetimeModule - # - # Test Infrastructure for AutoRest - # - class Datetime - include DatetimeModule::Models - - # - # Creates and initializes a new instance of the Datetime class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestDateTimeTestService - attr_reader :client - - # - # Get null datetime value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_null(custom_headers = nil) - # Construct URL - path = "/datetime/null" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = DateTime.parse(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get invalid datetime value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_invalid(custom_headers = nil) - # Construct URL - path = "/datetime/invalid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = DateTime.parse(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get overflow datetime value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_overflow(custom_headers = nil) - # Construct URL - path = "/datetime/overflow" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = DateTime.parse(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get underflow datetime value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_underflow(custom_headers = nil) - # Construct URL - path = "/datetime/underflow" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = DateTime.parse(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put max datetime value 9999-12-31T23:59:59.9999999Z - # - # @param datetime_body [DateTime] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_utc_max_date_time(datetime_body, custom_headers = nil) - fail ArgumentError, 'datetime_body is nil' if datetime_body.nil? - # Construct URL - path = "/datetime/max/utc" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - datetime_body = datetime_body.new_offset(0).strftime('%FT%TZ') - request_content = JSON.generate(datetime_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get max datetime value 9999-12-31t23:59:59.9999999z - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_utc_lowercase_max_date_time(custom_headers = nil) - # Construct URL - path = "/datetime/max/utc/lowercase" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = DateTime.parse(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get max datetime value 9999-12-31T23:59:59.9999999Z - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_utc_uppercase_max_date_time(custom_headers = nil) - # Construct URL - path = "/datetime/max/utc/uppercase" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = DateTime.parse(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put max datetime value with positive numoffset - # 9999-12-31t23:59:59.9999999+14:00 - # - # @param datetime_body [DateTime] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_local_positive_offset_max_date_time(datetime_body, custom_headers = nil) - fail ArgumentError, 'datetime_body is nil' if datetime_body.nil? - # Construct URL - path = "/datetime/max/localpositiveoffset" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - datetime_body = datetime_body.new_offset(0).strftime('%FT%TZ') - request_content = JSON.generate(datetime_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get max datetime value with positive num offset - # 9999-12-31t23:59:59.9999999+14:00 - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_local_positive_offset_lowercase_max_date_time(custom_headers = nil) - # Construct URL - path = "/datetime/max/localpositiveoffset/lowercase" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = DateTime.parse(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get max datetime value with positive num offset - # 9999-12-31T23:59:59.9999999+14:00 - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_local_positive_offset_uppercase_max_date_time(custom_headers = nil) - # Construct URL - path = "/datetime/max/localpositiveoffset/uppercase" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = DateTime.parse(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put max datetime value with positive numoffset - # 9999-12-31t23:59:59.9999999-14:00 - # - # @param datetime_body [DateTime] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_local_negative_offset_max_date_time(datetime_body, custom_headers = nil) - fail ArgumentError, 'datetime_body is nil' if datetime_body.nil? - # Construct URL - path = "/datetime/max/localnegativeoffset" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - datetime_body = datetime_body.new_offset(0).strftime('%FT%TZ') - request_content = JSON.generate(datetime_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get max datetime value with positive num offset - # 9999-12-31T23:59:59.9999999-14:00 - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_local_negative_offset_uppercase_max_date_time(custom_headers = nil) - # Construct URL - path = "/datetime/max/localnegativeoffset/uppercase" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = DateTime.parse(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get max datetime value with positive num offset - # 9999-12-31t23:59:59.9999999-14:00 - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_local_negative_offset_lowercase_max_date_time(custom_headers = nil) - # Construct URL - path = "/datetime/max/localnegativeoffset/lowercase" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = DateTime.parse(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put min datetime value 0001-01-01T00:00:00Z - # - # @param datetime_body [DateTime] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_utc_min_date_time(datetime_body, custom_headers = nil) - fail ArgumentError, 'datetime_body is nil' if datetime_body.nil? - # Construct URL - path = "/datetime/min/utc" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - datetime_body = datetime_body.new_offset(0).strftime('%FT%TZ') - request_content = JSON.generate(datetime_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get min datetime value 0001-01-01T00:00:00Z - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_utc_min_date_time(custom_headers = nil) - # Construct URL - path = "/datetime/min/utc" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = DateTime.parse(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put min datetime value 0001-01-01T00:00:00+14:00 - # - # @param datetime_body [DateTime] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_local_positive_offset_min_date_time(datetime_body, custom_headers = nil) - fail ArgumentError, 'datetime_body is nil' if datetime_body.nil? - # Construct URL - path = "/datetime/min/localpositiveoffset" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - datetime_body = datetime_body.new_offset(0).strftime('%FT%TZ') - request_content = JSON.generate(datetime_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get min datetime value 0001-01-01T00:00:00+14:00 - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_local_positive_offset_min_date_time(custom_headers = nil) - # Construct URL - path = "/datetime/min/localpositiveoffset" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = DateTime.parse(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put min datetime value 0001-01-01T00:00:00-14:00 - # - # @param datetime_body [DateTime] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_local_negative_offset_min_date_time(datetime_body, custom_headers = nil) - fail ArgumentError, 'datetime_body is nil' if datetime_body.nil? - # Construct URL - path = "/datetime/min/localnegativeoffset" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - datetime_body = datetime_body.new_offset(0).strftime('%FT%TZ') - request_content = JSON.generate(datetime_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get min datetime value 0001-01-01T00:00:00-14:00 - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_local_negative_offset_min_date_time(custom_headers = nil) - # Construct URL - path = "/datetime/min/localnegativeoffset" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = DateTime.parse(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/datetime/body_datetime/models/error.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/datetime/body_datetime/models/error.rb deleted file mode 100644 index 9fb3e96ca..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/datetime/body_datetime/models/error.rb +++ /dev/null @@ -1,69 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module DatetimeModule - module Models - # - # Model object. - # - class Error - # @return [Integer] - attr_accessor :status - - # @return [String] - attr_accessor :message - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.status - output_object['status'] = serialized_property unless serialized_property.nil? - - serialized_property = object.message - output_object['message'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Error] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Error.new - - deserialized_property = object['status'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.status = deserialized_property - - deserialized_property = object['message'] - output_object.message = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/datetime_rfc1123/body_datetime_rfc1123.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/datetime_rfc1123/body_datetime_rfc1123.rb deleted file mode 100644 index 0b69406e8..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/datetime_rfc1123/body_datetime_rfc1123.rb +++ /dev/null @@ -1,31 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -require 'uri' -require 'cgi' -require 'date' -require 'json' -require 'base64' -require 'erb' -require 'securerandom' -require 'time' -require 'timeliness' -require 'faraday' -require 'faraday-cookie_jar' -require 'concurrent' -require 'ms_rest' - -module DatetimeRfc1123Module - autoload :Datetimerfc1123, 'body_datetime_rfc1123/datetimerfc1123.rb' - autoload :AutoRestRFC1123DateTimeTestService, 'body_datetime_rfc1123/auto_rest_rfc1123date_time_test_service.rb' - - module Models - autoload :Error, 'body_datetime_rfc1123/models/error.rb' - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/datetime_rfc1123/body_datetime_rfc1123/auto_rest_rfc1123date_time_test_service.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/datetime_rfc1123/body_datetime_rfc1123/auto_rest_rfc1123date_time_test_service.rb deleted file mode 100644 index 58421b1c1..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/datetime_rfc1123/body_datetime_rfc1123/auto_rest_rfc1123date_time_test_service.rb +++ /dev/null @@ -1,41 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module DatetimeRfc1123Module - # - # A service client - single point of access to the REST API. - # - class AutoRestRFC1123DateTimeTestService < MsRest::ServiceClient - include DatetimeRfc1123Module::Models - - # @return [String] the base URI of the service. - attr_accessor :base_url - - # @return datetimerfc1123 - attr_reader :datetimerfc1123 - - # - # Creates initializes a new instance of the AutoRestRFC1123DateTimeTestService class. - # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. - # @param base_url [String] the base URI of the service. - # @param options [Array] filters to be applied to the HTTP requests. - # - def initialize(credentials, base_url = nil, options = nil) - super(credentials, options) - @base_url = base_url || 'https://localhost' - - fail ArgumentError, 'credentials is nil' if credentials.nil? - fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) - @credentials = credentials - - @datetimerfc1123 = Datetimerfc1123.new(self) - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/datetime_rfc1123/body_datetime_rfc1123/datetimerfc1123.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/datetime_rfc1123/body_datetime_rfc1123/datetimerfc1123.rb deleted file mode 100644 index 566b9ec62..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/datetime_rfc1123/body_datetime_rfc1123/datetimerfc1123.rb +++ /dev/null @@ -1,610 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module DatetimeRfc1123Module - # - # Test Infrastructure for AutoRest - # - class Datetimerfc1123 - include DatetimeRfc1123Module::Models - - # - # Creates and initializes a new instance of the Datetimerfc1123 class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestRFC1123DateTimeTestService - attr_reader :client - - # - # Get null datetime value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_null(custom_headers = nil) - # Construct URL - path = "/datetimerfc1123/null" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = DateTime.parse(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get invalid datetime value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_invalid(custom_headers = nil) - # Construct URL - path = "/datetimerfc1123/invalid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = DateTime.parse(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get overflow datetime value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_overflow(custom_headers = nil) - # Construct URL - path = "/datetimerfc1123/overflow" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = DateTime.parse(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get underflow datetime value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_underflow(custom_headers = nil) - # Construct URL - path = "/datetimerfc1123/underflow" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = DateTime.parse(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put max datetime value Fri, 31 Dec 9999 23:59:59 GMT - # - # @param datetime_body [DateTime] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_utc_max_date_time(datetime_body, custom_headers = nil) - fail ArgumentError, 'datetime_body is nil' if datetime_body.nil? - # Construct URL - path = "/datetimerfc1123/max" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - datetime_body = datetime_body.new_offset(0).strftime('%a, %d %b %Y %H:%M:%S GMT') - request_content = JSON.generate(datetime_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get max datetime value fri, 31 dec 9999 23:59:59 gmt - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_utc_lowercase_max_date_time(custom_headers = nil) - # Construct URL - path = "/datetimerfc1123/max/lowercase" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = DateTime.parse(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get max datetime value FRI, 31 DEC 9999 23:59:59 GMT - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_utc_uppercase_max_date_time(custom_headers = nil) - # Construct URL - path = "/datetimerfc1123/max/uppercase" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = DateTime.parse(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put min datetime value Mon, 1 Jan 0001 00:00:00 GMT - # - # @param datetime_body [DateTime] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_utc_min_date_time(datetime_body, custom_headers = nil) - fail ArgumentError, 'datetime_body is nil' if datetime_body.nil? - # Construct URL - path = "/datetimerfc1123/min" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - datetime_body = datetime_body.new_offset(0).strftime('%a, %d %b %Y %H:%M:%S GMT') - request_content = JSON.generate(datetime_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get min datetime value Mon, 1 Jan 0001 00:00:00 GMT - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_utc_min_date_time(custom_headers = nil) - # Construct URL - path = "/datetimerfc1123/min" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = DateTime.parse(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/datetime_rfc1123/body_datetime_rfc1123/models/error.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/datetime_rfc1123/body_datetime_rfc1123/models/error.rb deleted file mode 100644 index 9848de124..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/datetime_rfc1123/body_datetime_rfc1123/models/error.rb +++ /dev/null @@ -1,69 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module DatetimeRfc1123Module - module Models - # - # Model object. - # - class Error - # @return [Integer] - attr_accessor :status - - # @return [String] - attr_accessor :message - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.status - output_object['status'] = serialized_property unless serialized_property.nil? - - serialized_property = object.message - output_object['message'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Error] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Error.new - - deserialized_property = object['status'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.status = deserialized_property - - deserialized_property = object['message'] - output_object.message = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/dictionary/body_dictionary.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/dictionary/body_dictionary.rb deleted file mode 100644 index 7554aaf91..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/dictionary/body_dictionary.rb +++ /dev/null @@ -1,32 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -require 'uri' -require 'cgi' -require 'date' -require 'json' -require 'base64' -require 'erb' -require 'securerandom' -require 'time' -require 'timeliness' -require 'faraday' -require 'faraday-cookie_jar' -require 'concurrent' -require 'ms_rest' - -module DictionaryModule - autoload :Dictionary, 'body_dictionary/dictionary.rb' - autoload :AutoRestSwaggerBATdictionaryService, 'body_dictionary/auto_rest_swagger_batdictionary_service.rb' - - module Models - autoload :Widget, 'body_dictionary/models/widget.rb' - autoload :Error, 'body_dictionary/models/error.rb' - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/dictionary/body_dictionary/auto_rest_swagger_batdictionary_service.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/dictionary/body_dictionary/auto_rest_swagger_batdictionary_service.rb deleted file mode 100644 index 2b59b1df3..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/dictionary/body_dictionary/auto_rest_swagger_batdictionary_service.rb +++ /dev/null @@ -1,41 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module DictionaryModule - # - # A service client - single point of access to the REST API. - # - class AutoRestSwaggerBATdictionaryService < MsRest::ServiceClient - include DictionaryModule::Models - - # @return [String] the base URI of the service. - attr_accessor :base_url - - # @return dictionary - attr_reader :dictionary - - # - # Creates initializes a new instance of the AutoRestSwaggerBATdictionaryService class. - # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. - # @param base_url [String] the base URI of the service. - # @param options [Array] filters to be applied to the HTTP requests. - # - def initialize(credentials, base_url = nil, options = nil) - super(credentials, options) - @base_url = base_url || 'http://localhost' - - fail ArgumentError, 'credentials is nil' if credentials.nil? - fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) - @credentials = credentials - - @dictionary = Dictionary.new(self) - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/dictionary/body_dictionary/dictionary.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/dictionary/body_dictionary/dictionary.rb deleted file mode 100644 index d1ac48a2d..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/dictionary/body_dictionary/dictionary.rb +++ /dev/null @@ -1,4341 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module DictionaryModule - # - # Test Infrastructure for AutoRest Swagger BAT - # - class Dictionary - include DictionaryModule::Models - - # - # Creates and initializes a new instance of the Dictionary class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestSwaggerBATdictionaryService - attr_reader :client - - # - # Get null dictionary value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_null(custom_headers = nil) - # Construct URL - path = "/dictionary/null" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response.each do |key, valueElement| - valueElement = Integer(valueElement) unless valueElement.to_s.empty? - parsed_response[key] = valueElement - end - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get empty dictionary value {} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_empty(custom_headers = nil) - # Construct URL - path = "/dictionary/empty" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response.each do |key, valueElement| - valueElement = Integer(valueElement) unless valueElement.to_s.empty? - parsed_response[key] = valueElement - end - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Set dictionary value empty {} - # - # @param array_body [Hash{String => String}] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_empty(array_body, custom_headers = nil) - fail ArgumentError, 'array_body is nil' if array_body.nil? - array_body.each{ |e| e.validate if e.respond_to?(:validate) } unless array_body.nil? - # Construct URL - path = "/dictionary/empty" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(array_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get Dictionary with null value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_null_value(custom_headers = nil) - # Construct URL - path = "/dictionary/nullvalue" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get Dictionary with null key - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_null_key(custom_headers = nil) - # Construct URL - path = "/dictionary/nullkey" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get Dictionary with key as empty string - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_empty_string_key(custom_headers = nil) - # Construct URL - path = "/dictionary/keyemptystring" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get invalid Dictionary value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_invalid(custom_headers = nil) - # Construct URL - path = "/dictionary/invalid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get boolean dictionary value {"0": true, "1": false, "2": false, "3": true } - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_boolean_tfft(custom_headers = nil) - # Construct URL - path = "/dictionary/prim/boolean/tfft" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Set dictionary value empty {"0": true, "1": false, "2": false, "3": true } - # - # @param array_body [Hash{String => Boolean}] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_boolean_tfft(array_body, custom_headers = nil) - fail ArgumentError, 'array_body is nil' if array_body.nil? - array_body.each{ |e| e.validate if e.respond_to?(:validate) } unless array_body.nil? - # Construct URL - path = "/dictionary/prim/boolean/tfft" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(array_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get boolean dictionary value {"0": true, "1": null, "2": false } - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_boolean_invalid_null(custom_headers = nil) - # Construct URL - path = "/dictionary/prim/boolean/true.null.false" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get boolean dictionary value '{"0": true, "1": "boolean", "2": false}' - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_boolean_invalid_string(custom_headers = nil) - # Construct URL - path = "/dictionary/prim/boolean/true.boolean.false" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get integer dictionary value {"0": 1, "1": -1, "2": 3, "3": 300} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_integer_valid(custom_headers = nil) - # Construct URL - path = "/dictionary/prim/integer/1.-1.3.300" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response.each do |key, valueElement| - valueElement = Integer(valueElement) unless valueElement.to_s.empty? - parsed_response[key] = valueElement - end - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Set dictionary value empty {"0": 1, "1": -1, "2": 3, "3": 300} - # - # @param array_body [Hash{String => Integer}] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_integer_valid(array_body, custom_headers = nil) - fail ArgumentError, 'array_body is nil' if array_body.nil? - array_body.each{ |e| e.validate if e.respond_to?(:validate) } unless array_body.nil? - # Construct URL - path = "/dictionary/prim/integer/1.-1.3.300" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(array_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get integer dictionary value {"0": 1, "1": null, "2": 0} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_int_invalid_null(custom_headers = nil) - # Construct URL - path = "/dictionary/prim/integer/1.null.zero" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response.each do |key, valueElement| - valueElement = Integer(valueElement) unless valueElement.to_s.empty? - parsed_response[key] = valueElement - end - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get integer dictionary value {"0": 1, "1": "integer", "2": 0} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_int_invalid_string(custom_headers = nil) - # Construct URL - path = "/dictionary/prim/integer/1.integer.0" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response.each do |key, valueElement| - valueElement = Integer(valueElement) unless valueElement.to_s.empty? - parsed_response[key] = valueElement - end - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get integer dictionary value {"0": 1, "1": -1, "2": 3, "3": 300} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_long_valid(custom_headers = nil) - # Construct URL - path = "/dictionary/prim/long/1.-1.3.300" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response.each do |key, valueElement| - valueElement = Integer(valueElement) unless valueElement.to_s.empty? - parsed_response[key] = valueElement - end - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Set dictionary value empty {"0": 1, "1": -1, "2": 3, "3": 300} - # - # @param array_body [Hash{String => Integer}] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_long_valid(array_body, custom_headers = nil) - fail ArgumentError, 'array_body is nil' if array_body.nil? - array_body.each{ |e| e.validate if e.respond_to?(:validate) } unless array_body.nil? - # Construct URL - path = "/dictionary/prim/long/1.-1.3.300" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(array_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get long dictionary value {"0": 1, "1": null, "2": 0} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_long_invalid_null(custom_headers = nil) - # Construct URL - path = "/dictionary/prim/long/1.null.zero" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response.each do |key, valueElement| - valueElement = Integer(valueElement) unless valueElement.to_s.empty? - parsed_response[key] = valueElement - end - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get long dictionary value {"0": 1, "1": "integer", "2": 0} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_long_invalid_string(custom_headers = nil) - # Construct URL - path = "/dictionary/prim/long/1.integer.0" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response.each do |key, valueElement| - valueElement = Integer(valueElement) unless valueElement.to_s.empty? - parsed_response[key] = valueElement - end - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get float dictionary value {"0": 0, "1": -0.01, "2": 1.2e20} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_float_valid(custom_headers = nil) - # Construct URL - path = "/dictionary/prim/float/0--0.01-1.2e20" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response.each do |key, valueElement| - valueElement = Float(valueElement) unless valueElement.to_s.empty? - parsed_response[key] = valueElement - end - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Set dictionary value {"0": 0, "1": -0.01, "2": 1.2e20} - # - # @param array_body [Hash{String => Float}] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_float_valid(array_body, custom_headers = nil) - fail ArgumentError, 'array_body is nil' if array_body.nil? - array_body.each{ |e| e.validate if e.respond_to?(:validate) } unless array_body.nil? - # Construct URL - path = "/dictionary/prim/float/0--0.01-1.2e20" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(array_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get float dictionary value {"0": 0.0, "1": null, "2": 1.2e20} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_float_invalid_null(custom_headers = nil) - # Construct URL - path = "/dictionary/prim/float/0.0-null-1.2e20" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response.each do |key, valueElement| - valueElement = Float(valueElement) unless valueElement.to_s.empty? - parsed_response[key] = valueElement - end - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get boolean dictionary value {"0": 1.0, "1": "number", "2": 0.0} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_float_invalid_string(custom_headers = nil) - # Construct URL - path = "/dictionary/prim/float/1.number.0" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response.each do |key, valueElement| - valueElement = Float(valueElement) unless valueElement.to_s.empty? - parsed_response[key] = valueElement - end - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get float dictionary value {"0": 0, "1": -0.01, "2": 1.2e20} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_double_valid(custom_headers = nil) - # Construct URL - path = "/dictionary/prim/double/0--0.01-1.2e20" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response.each do |key, valueElement| - valueElement = Float(valueElement) unless valueElement.to_s.empty? - parsed_response[key] = valueElement - end - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Set dictionary value {"0": 0, "1": -0.01, "2": 1.2e20} - # - # @param array_body [Hash{String => Float}] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_double_valid(array_body, custom_headers = nil) - fail ArgumentError, 'array_body is nil' if array_body.nil? - array_body.each{ |e| e.validate if e.respond_to?(:validate) } unless array_body.nil? - # Construct URL - path = "/dictionary/prim/double/0--0.01-1.2e20" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(array_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get float dictionary value {"0": 0.0, "1": null, "2": 1.2e20} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_double_invalid_null(custom_headers = nil) - # Construct URL - path = "/dictionary/prim/double/0.0-null-1.2e20" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response.each do |key, valueElement| - valueElement = Float(valueElement) unless valueElement.to_s.empty? - parsed_response[key] = valueElement - end - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get boolean dictionary value {"0": 1.0, "1": "number", "2": 0.0} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_double_invalid_string(custom_headers = nil) - # Construct URL - path = "/dictionary/prim/double/1.number.0" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response.each do |key, valueElement| - valueElement = Float(valueElement) unless valueElement.to_s.empty? - parsed_response[key] = valueElement - end - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get string dictionary value {"0": "foo1", "1": "foo2", "2": "foo3"} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_string_valid(custom_headers = nil) - # Construct URL - path = "/dictionary/prim/string/foo1.foo2.foo3" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Set dictionary value {"0": "foo1", "1": "foo2", "2": "foo3"} - # - # @param array_body [Hash{String => String}] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_string_valid(array_body, custom_headers = nil) - fail ArgumentError, 'array_body is nil' if array_body.nil? - array_body.each{ |e| e.validate if e.respond_to?(:validate) } unless array_body.nil? - # Construct URL - path = "/dictionary/prim/string/foo1.foo2.foo3" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(array_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get string dictionary value {"0": "foo", "1": null, "2": "foo2"} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_string_with_null(custom_headers = nil) - # Construct URL - path = "/dictionary/prim/string/foo.null.foo2" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get string dictionary value {"0": "foo", "1": 123, "2": "foo2"} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_string_with_invalid(custom_headers = nil) - # Construct URL - path = "/dictionary/prim/string/foo.123.foo2" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get integer dictionary value {"0": "2000-12-01", "1": "1980-01-02", "2": - # "1492-10-12"} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_date_valid(custom_headers = nil) - # Construct URL - path = "/dictionary/prim/date/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response.each do |key, valueElement| - valueElement = MsRest::Serialization.deserialize_date(valueElement) unless valueElement.to_s.empty? - parsed_response[key] = valueElement - end - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Set dictionary value {"0": "2000-12-01", "1": "1980-01-02", "2": - # "1492-10-12"} - # - # @param array_body [Hash{String => Date}] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_date_valid(array_body, custom_headers = nil) - fail ArgumentError, 'array_body is nil' if array_body.nil? - array_body.each{ |e| e.validate if e.respond_to?(:validate) } unless array_body.nil? - # Construct URL - path = "/dictionary/prim/date/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(array_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get date dictionary value {"0": "2012-01-01", "1": null, "2": "1776-07-04"} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_date_invalid_null(custom_headers = nil) - # Construct URL - path = "/dictionary/prim/date/invalidnull" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response.each do |key, valueElement| - valueElement = MsRest::Serialization.deserialize_date(valueElement) unless valueElement.to_s.empty? - parsed_response[key] = valueElement - end - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get date dictionary value {"0": "2011-03-22", "1": "date"} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_date_invalid_chars(custom_headers = nil) - # Construct URL - path = "/dictionary/prim/date/invalidchars" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response.each do |key, valueElement| - valueElement = MsRest::Serialization.deserialize_date(valueElement) unless valueElement.to_s.empty? - parsed_response[key] = valueElement - end - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get date-time dictionary value {"0": "2000-12-01t00:00:01z", "1": - # "1980-01-02T00:11:35+01:00", "2": "1492-10-12T10:15:01-08:00"} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_date_time_valid(custom_headers = nil) - # Construct URL - path = "/dictionary/prim/date-time/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response.each do |key, valueElement| - valueElement = DateTime.parse(valueElement) unless valueElement.to_s.empty? - parsed_response[key] = valueElement - end - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Set dictionary value {"0": "2000-12-01t00:00:01z", "1": - # "1980-01-02T00:11:35+01:00", "2": "1492-10-12T10:15:01-08:00"} - # - # @param array_body [Hash{String => DateTime}] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_date_time_valid(array_body, custom_headers = nil) - fail ArgumentError, 'array_body is nil' if array_body.nil? - array_body.each{ |e| e.validate if e.respond_to?(:validate) } unless array_body.nil? - # Construct URL - path = "/dictionary/prim/date-time/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless array_body.nil? - array_body.each { |key, valueElement| - valueElement = valueElement.new_offset(0).strftime('%FT%TZ') - array_body[key] = valueElement - } - end - request_content = JSON.generate(array_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get date dictionary value {"0": "2000-12-01t00:00:01z", "1": null} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_date_time_invalid_null(custom_headers = nil) - # Construct URL - path = "/dictionary/prim/date-time/invalidnull" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response.each do |key, valueElement| - valueElement = DateTime.parse(valueElement) unless valueElement.to_s.empty? - parsed_response[key] = valueElement - end - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get date dictionary value {"0": "2000-12-01t00:00:01z", "1": "date-time"} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_date_time_invalid_chars(custom_headers = nil) - # Construct URL - path = "/dictionary/prim/date-time/invalidchars" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response.each do |key, valueElement| - valueElement = DateTime.parse(valueElement) unless valueElement.to_s.empty? - parsed_response[key] = valueElement - end - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get date-time-rfc1123 dictionary value {"0": "Fri, 01 Dec 2000 00:00:01 - # GMT", "1": "Wed, 02 Jan 1980 00:11:35 GMT", "2": "Wed, 12 Oct 1492 10:15:01 - # GMT"} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_date_time_rfc1123valid(custom_headers = nil) - # Construct URL - path = "/dictionary/prim/date-time-rfc1123/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response.each do |key, valueElement| - valueElement = DateTime.parse(valueElement) unless valueElement.to_s.empty? - parsed_response[key] = valueElement - end - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Set dictionary value empty {"0": "Fri, 01 Dec 2000 00:00:01 GMT", "1": "Wed, - # 02 Jan 1980 00:11:35 GMT", "2": "Wed, 12 Oct 1492 10:15:01 GMT"} - # - # @param array_body [Hash{String => DateTime}] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_date_time_rfc1123valid(array_body, custom_headers = nil) - fail ArgumentError, 'array_body is nil' if array_body.nil? - array_body.each{ |e| e.validate if e.respond_to?(:validate) } unless array_body.nil? - # Construct URL - path = "/dictionary/prim/date-time-rfc1123/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless array_body.nil? - array_body.each { |key, valueElement| - valueElement = valueElement.new_offset(0).strftime('%a, %d %b %Y %H:%M:%S GMT') - array_body[key] = valueElement - } - end - request_content = JSON.generate(array_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get duration dictionary value {"0": "P123DT22H14M12.011S", "1": "P5DT1H0M0S"} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_duration_valid(custom_headers = nil) - # Construct URL - path = "/dictionary/prim/duration/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Set dictionary value {"0": "P123DT22H14M12.011S", "1": "P5DT1H0M0S"} - # - # @param array_body [Hash{String => Duration}] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_duration_valid(array_body, custom_headers = nil) - fail ArgumentError, 'array_body is nil' if array_body.nil? - array_body.each{ |e| e.validate if e.respond_to?(:validate) } unless array_body.nil? - # Construct URL - path = "/dictionary/prim/duration/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(array_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get byte dictionary value {"0": hex(FF FF FF FA), "1": hex(01 02 03), "2": - # hex (25, 29, 43)} with each item encoded in base64 - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_byte_valid(custom_headers = nil) - # Construct URL - path = "/dictionary/prim/byte/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response.each do |key, valueElement| - valueElement = Base64.strict_decode64(valueElement).unpack('C*') unless valueElement.to_s.empty? - parsed_response[key] = valueElement - end - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put the dictionary value {"0": hex(FF FF FF FA), "1": hex(01 02 03), "2": - # hex (25, 29, 43)} with each elementencoded in base 64 - # - # @param array_body [Hash{String => Array}] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_byte_valid(array_body, custom_headers = nil) - fail ArgumentError, 'array_body is nil' if array_body.nil? - array_body.each{ |e| e.validate if e.respond_to?(:validate) } unless array_body.nil? - # Construct URL - path = "/dictionary/prim/byte/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless array_body.nil? - array_body.each { |key, valueElement| - valueElement = Base64.strict_encode64(valueElement.pack('c*')) - array_body[key] = valueElement - } - end - request_content = JSON.generate(array_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get byte dictionary value {"0": hex(FF FF FF FA), "1": null} with the first - # item base64 encoded - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_byte_invalid_null(custom_headers = nil) - # Construct URL - path = "/dictionary/prim/byte/invalidnull" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response.each do |key, valueElement| - valueElement = Base64.strict_decode64(valueElement).unpack('C*') unless valueElement.to_s.empty? - parsed_response[key] = valueElement - end - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get dictionary of complex type null value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_complex_null(custom_headers = nil) - # Construct URL - path = "/dictionary/complex/null" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response.each do |key, valueElement| - unless valueElement.nil? - valueElement = Widget.deserialize_object(valueElement) - end - parsed_response[key] = valueElement - end - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get empty dictionary of complex type {} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_complex_empty(custom_headers = nil) - # Construct URL - path = "/dictionary/complex/empty" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response.each do |key, valueElement| - unless valueElement.nil? - valueElement = Widget.deserialize_object(valueElement) - end - parsed_response[key] = valueElement - end - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get dictionary of complex type with null item {"0": {"integer": 1, "string": - # "2"}, "1": null, "2": {"integer": 5, "string": "6"}} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_complex_item_null(custom_headers = nil) - # Construct URL - path = "/dictionary/complex/itemnull" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response.each do |key, valueElement| - unless valueElement.nil? - valueElement = Widget.deserialize_object(valueElement) - end - parsed_response[key] = valueElement - end - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get dictionary of complex type with empty item {"0": {"integer": 1, - # "string": "2"}, "1:" {}, "2": {"integer": 5, "string": "6"}} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_complex_item_empty(custom_headers = nil) - # Construct URL - path = "/dictionary/complex/itemempty" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response.each do |key, valueElement| - unless valueElement.nil? - valueElement = Widget.deserialize_object(valueElement) - end - parsed_response[key] = valueElement - end - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get dictionary of complex type with {"0": {"integer": 1, "string": "2"}, - # "1": {"integer": 3, "string": "4"}, "2": {"integer": 5, "string": "6"}} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_complex_valid(custom_headers = nil) - # Construct URL - path = "/dictionary/complex/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response.each do |key, valueElement| - unless valueElement.nil? - valueElement = Widget.deserialize_object(valueElement) - end - parsed_response[key] = valueElement - end - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put an dictionary of complex type with values {"0": {"integer": 1, "string": - # "2"}, "1": {"integer": 3, "string": "4"}, "2": {"integer": 5, "string": - # "6"}} - # - # @param array_body [Hash{String => Widget}] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_complex_valid(array_body, custom_headers = nil) - fail ArgumentError, 'array_body is nil' if array_body.nil? - array_body.each{ |e| e.validate if e.respond_to?(:validate) } unless array_body.nil? - # Construct URL - path = "/dictionary/complex/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless array_body.nil? - array_body.each { |key, valueElement| - unless valueElement.nil? - valueElement = Widget.serialize_object(valueElement) - end - array_body[key] = valueElement - } - end - request_content = JSON.generate(array_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get a null array - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_array_null(custom_headers = nil) - # Construct URL - path = "/dictionary/array/null" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get an empty dictionary {} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_array_empty(custom_headers = nil) - # Construct URL - path = "/dictionary/array/empty" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get an dictionary of array of strings {"0": ["1", "2", "3"], "1": null, "2": - # ["7", "8", "9"]} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_array_item_null(custom_headers = nil) - # Construct URL - path = "/dictionary/array/itemnull" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get an array of array of strings [{"0": ["1", "2", "3"], "1": [], "2": ["7", - # "8", "9"]} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_array_item_empty(custom_headers = nil) - # Construct URL - path = "/dictionary/array/itemempty" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get an array of array of strings {"0": ["1", "2", "3"], "1": ["4", "5", - # "6"], "2": ["7", "8", "9"]} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_array_valid(custom_headers = nil) - # Construct URL - path = "/dictionary/array/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put An array of array of strings {"0": ["1", "2", "3"], "1": ["4", "5", - # "6"], "2": ["7", "8", "9"]} - # - # @param array_body [Hash{String => Array}] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_array_valid(array_body, custom_headers = nil) - fail ArgumentError, 'array_body is nil' if array_body.nil? - array_body.each{ |e| e.validate if e.respond_to?(:validate) } unless array_body.nil? - # Construct URL - path = "/dictionary/array/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(array_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get an dictionaries of dictionaries with value null - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_dictionary_null(custom_headers = nil) - # Construct URL - path = "/dictionary/dictionary/null" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get an dictionaries of dictionaries of type with value {} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_dictionary_empty(custom_headers = nil) - # Construct URL - path = "/dictionary/dictionary/empty" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get an dictionaries of dictionaries of type with value - # {"0": {"1": "one", "2": "two", "3": "three"}, "1": null, "2": {"7": - # "seven", "8": "eight", "9": "nine"}} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_dictionary_item_null(custom_headers = nil) - # Construct URL - path = "/dictionary/dictionary/itemnull" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get an dictionaries of dictionaries of type with value - # {"0": {"1": "one", "2": "two", "3": "three"}, "1": {}, "2": {"7": "seven", - # "8": "eight", "9": "nine"}} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_dictionary_item_empty(custom_headers = nil) - # Construct URL - path = "/dictionary/dictionary/itemempty" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get an dictionaries of dictionaries of type with value - # {"0": {"1": "one", "2": "two", "3": "three"}, "1": {"4": "four", "5": - # "five", "6": "six"}, "2": {"7": "seven", "8": "eight", "9": "nine"}} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_dictionary_valid(custom_headers = nil) - # Construct URL - path = "/dictionary/dictionary/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get an dictionaries of dictionaries of type with value - # {"0": {"1": "one", "2": "two", "3": "three"}, "1": {"4": "four", "5": - # "five", "6": "six"}, "2": {"7": "seven", "8": "eight", "9": "nine"}} - # - # @param array_body [Hash{String => Hash{String => String}}] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_dictionary_valid(array_body, custom_headers = nil) - fail ArgumentError, 'array_body is nil' if array_body.nil? - array_body.each{ |e| e.validate if e.respond_to?(:validate) } unless array_body.nil? - # Construct URL - path = "/dictionary/dictionary/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(array_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/dictionary/body_dictionary/models/error.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/dictionary/body_dictionary/models/error.rb deleted file mode 100644 index 1ac34a76e..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/dictionary/body_dictionary/models/error.rb +++ /dev/null @@ -1,69 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module DictionaryModule - module Models - # - # Model object. - # - class Error - # @return [Integer] - attr_accessor :status - - # @return [String] - attr_accessor :message - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.status - output_object['status'] = serialized_property unless serialized_property.nil? - - serialized_property = object.message - output_object['message'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Error] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Error.new - - deserialized_property = object['status'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.status = deserialized_property - - deserialized_property = object['message'] - output_object.message = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/dictionary/body_dictionary/models/widget.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/dictionary/body_dictionary/models/widget.rb deleted file mode 100644 index c59e2f23e..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/dictionary/body_dictionary/models/widget.rb +++ /dev/null @@ -1,69 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module DictionaryModule - module Models - # - # Model object. - # - class Widget - # @return [Integer] - attr_accessor :integer - - # @return [String] - attr_accessor :string - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.integer - output_object['integer'] = serialized_property unless serialized_property.nil? - - serialized_property = object.string - output_object['string'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Widget] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Widget.new - - deserialized_property = object['integer'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.integer = deserialized_property - - deserialized_property = object['string'] - output_object.string = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/duration/body_duration.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/duration/body_duration.rb deleted file mode 100644 index f9abd668b..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/duration/body_duration.rb +++ /dev/null @@ -1,31 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -require 'uri' -require 'cgi' -require 'date' -require 'json' -require 'base64' -require 'erb' -require 'securerandom' -require 'time' -require 'timeliness' -require 'faraday' -require 'faraday-cookie_jar' -require 'concurrent' -require 'ms_rest' - -module DurationModule - autoload :Duration, 'body_duration/duration.rb' - autoload :AutoRestDurationTestService, 'body_duration/auto_rest_duration_test_service.rb' - - module Models - autoload :Error, 'body_duration/models/error.rb' - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/duration/body_duration/auto_rest_duration_test_service.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/duration/body_duration/auto_rest_duration_test_service.rb deleted file mode 100644 index aeba93644..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/duration/body_duration/auto_rest_duration_test_service.rb +++ /dev/null @@ -1,41 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module DurationModule - # - # A service client - single point of access to the REST API. - # - class AutoRestDurationTestService < MsRest::ServiceClient - include DurationModule::Models - - # @return [String] the base URI of the service. - attr_accessor :base_url - - # @return duration - attr_reader :duration - - # - # Creates initializes a new instance of the AutoRestDurationTestService class. - # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. - # @param base_url [String] the base URI of the service. - # @param options [Array] filters to be applied to the HTTP requests. - # - def initialize(credentials, base_url = nil, options = nil) - super(credentials, options) - @base_url = base_url || 'https://localhost' - - fail ArgumentError, 'credentials is nil' if credentials.nil? - fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) - @credentials = credentials - - @duration = Duration.new(self) - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/duration/body_duration/duration.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/duration/body_duration/duration.rb deleted file mode 100644 index 2af09a9a0..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/duration/body_duration/duration.rb +++ /dev/null @@ -1,283 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module DurationModule - # - # Test Infrastructure for AutoRest - # - class Duration - include DurationModule::Models - - # - # Creates and initializes a new instance of the Duration class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestDurationTestService - attr_reader :client - - # - # Get null duration value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_null(custom_headers = nil) - # Construct URL - path = "/duration/null" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put a positive duration value - # - # @param duration_body [Duration] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_positive_duration(duration_body, custom_headers = nil) - fail ArgumentError, 'duration_body is nil' if duration_body.nil? - # Construct URL - path = "/duration/positiveduration" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(duration_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get a positive duration value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_positive_duration(custom_headers = nil) - # Construct URL - path = "/duration/positiveduration" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get an invalid duration value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_invalid(custom_headers = nil) - # Construct URL - path = "/duration/invalid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/duration/body_duration/models/error.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/duration/body_duration/models/error.rb deleted file mode 100644 index 8fb6e3ddb..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/duration/body_duration/models/error.rb +++ /dev/null @@ -1,69 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module DurationModule - module Models - # - # Model object. - # - class Error - # @return [Integer] - attr_accessor :status - - # @return [String] - attr_accessor :message - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.status - output_object['status'] = serialized_property unless serialized_property.nil? - - serialized_property = object.message - output_object['message'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Error] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Error.new - - deserialized_property = object['status'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.status = deserialized_property - - deserialized_property = object['message'] - output_object.message = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/header_folder/header.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/header_folder/header.rb deleted file mode 100644 index 059fa5f7a..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/header_folder/header.rb +++ /dev/null @@ -1,32 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -require 'uri' -require 'cgi' -require 'date' -require 'json' -require 'base64' -require 'erb' -require 'securerandom' -require 'time' -require 'timeliness' -require 'faraday' -require 'faraday-cookie_jar' -require 'concurrent' -require 'ms_rest' - -module HeaderModule - autoload :Header, 'header/header.rb' - autoload :AutoRestSwaggerBATHeaderService, 'header/auto_rest_swagger_batheader_service.rb' - - module Models - autoload :Error, 'header/models/error.rb' - autoload :GreyscaleColors, 'header/models/greyscale_colors.rb' - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/header_folder/header/auto_rest_swagger_batheader_service.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/header_folder/header/auto_rest_swagger_batheader_service.rb deleted file mode 100644 index aeb0c6c53..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/header_folder/header/auto_rest_swagger_batheader_service.rb +++ /dev/null @@ -1,41 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module HeaderModule - # - # A service client - single point of access to the REST API. - # - class AutoRestSwaggerBATHeaderService < MsRest::ServiceClient - include HeaderModule::Models - - # @return [String] the base URI of the service. - attr_accessor :base_url - - # @return header - attr_reader :header - - # - # Creates initializes a new instance of the AutoRestSwaggerBATHeaderService class. - # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. - # @param base_url [String] the base URI of the service. - # @param options [Array] filters to be applied to the HTTP requests. - # - def initialize(credentials, base_url = nil, options = nil) - super(credentials, options) - @base_url = base_url || 'http://localhost' - - fail ArgumentError, 'credentials is nil' if credentials.nil? - fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) - @credentials = credentials - - @header = Header.new(self) - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/header_folder/header/header.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/header_folder/header/header.rb deleted file mode 100644 index 0a111a9d2..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/header_folder/header/header.rb +++ /dev/null @@ -1,1839 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module HeaderModule - # - # Test Infrastructure for AutoRest - # - class Header - include HeaderModule::Models - - # - # Creates and initializes a new instance of the Header class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestSwaggerBATHeaderService - attr_reader :client - - # - # Send a post request with header value "User-Agent": "overwrite" - # - # @param user_agent [String] Send a post request with header value - # "User-Agent": "overwrite" - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def param_existing_key(user_agent, custom_headers = nil) - fail ArgumentError, 'user_agent is nil' if user_agent.nil? - # Construct URL - path = "/header/param/existingkey" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["User-Agent"] = user_agent unless user_agent.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get a response with header value "User-Agent": "overwrite" - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def response_existing_key(custom_headers = nil) - # Construct URL - path = "/header/response/existingkey" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Send a post request with header value "Content-Type": "text/html" - # - # @param content_type [String] Send a post request with header value - # "Content-Type": "text/html" - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def param_protected_key(content_type, custom_headers = nil) - fail ArgumentError, 'content_type is nil' if content_type.nil? - # Construct URL - path = "/header/param/protectedkey" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - fail RuntimeError, 'Header Content-Type is forbidden to change' - request_headers["Content-Type"] = content_type unless content_type.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get a response with header value "Content-Type": "text/html" - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def response_protected_key(custom_headers = nil) - # Construct URL - path = "/header/response/protectedkey" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Send a post request with header values "scenario": "positive", "value": 1 or - # "scenario": "negative", "value": -2 - # - # @param scenario [String] Send a post request with header values "scenario": - # "positive" or "negative" - # @param value [Integer] Send a post request with header values 1 or -2 - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def param_integer(scenario, value, custom_headers = nil) - fail ArgumentError, 'scenario is nil' if scenario.nil? - fail ArgumentError, 'value is nil' if value.nil? - # Construct URL - path = "/header/param/prim/integer" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["scenario"] = scenario unless scenario.nil? - request_headers["value"] = value.to_s unless value.to_s.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get a response with header value "value": 1 or -2 - # - # @param scenario [String] Send a post request with header values "scenario": - # "positive" or "negative" - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def response_integer(scenario, custom_headers = nil) - fail ArgumentError, 'scenario is nil' if scenario.nil? - # Construct URL - path = "/header/response/prim/integer" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["scenario"] = scenario unless scenario.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Send a post request with header values "scenario": "positive", "value": 105 - # or "scenario": "negative", "value": -2 - # - # @param scenario [String] Send a post request with header values "scenario": - # "positive" or "negative" - # @param value [Integer] Send a post request with header values 105 or -2 - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def param_long(scenario, value, custom_headers = nil) - fail ArgumentError, 'scenario is nil' if scenario.nil? - fail ArgumentError, 'value is nil' if value.nil? - # Construct URL - path = "/header/param/prim/long" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["scenario"] = scenario unless scenario.nil? - request_headers["value"] = value.to_s unless value.to_s.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get a response with header value "value": 105 or -2 - # - # @param scenario [String] Send a post request with header values "scenario": - # "positive" or "negative" - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def response_long(scenario, custom_headers = nil) - fail ArgumentError, 'scenario is nil' if scenario.nil? - # Construct URL - path = "/header/response/prim/long" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["scenario"] = scenario unless scenario.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Send a post request with header values "scenario": "positive", "value": 0.07 - # or "scenario": "negative", "value": -3.0 - # - # @param scenario [String] Send a post request with header values "scenario": - # "positive" or "negative" - # @param value [Float] Send a post request with header values 0.07 or -3.0 - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def param_float(scenario, value, custom_headers = nil) - fail ArgumentError, 'scenario is nil' if scenario.nil? - fail ArgumentError, 'value is nil' if value.nil? - # Construct URL - path = "/header/param/prim/float" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["scenario"] = scenario unless scenario.nil? - request_headers["value"] = value.to_s unless value.to_s.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get a response with header value "value": 0.07 or -3.0 - # - # @param scenario [String] Send a post request with header values "scenario": - # "positive" or "negative" - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def response_float(scenario, custom_headers = nil) - fail ArgumentError, 'scenario is nil' if scenario.nil? - # Construct URL - path = "/header/response/prim/float" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["scenario"] = scenario unless scenario.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Send a post request with header values "scenario": "positive", "value": - # 7e120 or "scenario": "negative", "value": -3.0 - # - # @param scenario [String] Send a post request with header values "scenario": - # "positive" or "negative" - # @param value [Float] Send a post request with header values 7e120 or -3.0 - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def param_double(scenario, value, custom_headers = nil) - fail ArgumentError, 'scenario is nil' if scenario.nil? - fail ArgumentError, 'value is nil' if value.nil? - # Construct URL - path = "/header/param/prim/double" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["scenario"] = scenario unless scenario.nil? - request_headers["value"] = value.to_s unless value.to_s.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get a response with header value "value": 7e120 or -3.0 - # - # @param scenario [String] Send a post request with header values "scenario": - # "positive" or "negative" - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def response_double(scenario, custom_headers = nil) - fail ArgumentError, 'scenario is nil' if scenario.nil? - # Construct URL - path = "/header/response/prim/double" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["scenario"] = scenario unless scenario.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Send a post request with header values "scenario": "true", "value": true or - # "scenario": "false", "value": false - # - # @param scenario [String] Send a post request with header values "scenario": - # "true" or "false" - # @param value [Boolean] Send a post request with header values true or false - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def param_bool(scenario, value, custom_headers = nil) - fail ArgumentError, 'scenario is nil' if scenario.nil? - fail ArgumentError, 'value is nil' if value.nil? - # Construct URL - path = "/header/param/prim/bool" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["scenario"] = scenario unless scenario.nil? - request_headers["value"] = value.to_s unless value.to_s.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get a response with header value "value": true or false - # - # @param scenario [String] Send a post request with header values "scenario": - # "true" or "false" - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def response_bool(scenario, custom_headers = nil) - fail ArgumentError, 'scenario is nil' if scenario.nil? - # Construct URL - path = "/header/response/prim/bool" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["scenario"] = scenario unless scenario.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Send a post request with header values "scenario": "valid", "value": "The - # quick brown fox jumps over the lazy dog" or "scenario": "null", "value": - # null or "scenario": "empty", "value": "" - # - # @param scenario [String] Send a post request with header values "scenario": - # "valid" or "null" or "empty" - # @param value [String] Send a post request with header values "The quick - # brown fox jumps over the lazy dog" or null or "" - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def param_string(scenario, value = nil, custom_headers = nil) - fail ArgumentError, 'scenario is nil' if scenario.nil? - # Construct URL - path = "/header/param/prim/string" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["scenario"] = scenario unless scenario.nil? - request_headers["value"] = value unless value.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get a response with header values "The quick brown fox jumps over the lazy - # dog" or null or "" - # - # @param scenario [String] Send a post request with header values "scenario": - # "valid" or "null" or "empty" - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def response_string(scenario, custom_headers = nil) - fail ArgumentError, 'scenario is nil' if scenario.nil? - # Construct URL - path = "/header/response/prim/string" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["scenario"] = scenario unless scenario.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Send a post request with header values "scenario": "valid", "value": - # "2010-01-01" or "scenario": "min", "value": "0001-01-01" - # - # @param scenario [String] Send a post request with header values "scenario": - # "valid" or "min" - # @param value [Date] Send a post request with header values "2010-01-01" or - # "0001-01-01" - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def param_date(scenario, value, custom_headers = nil) - fail ArgumentError, 'scenario is nil' if scenario.nil? - fail ArgumentError, 'value is nil' if value.nil? - # Construct URL - path = "/header/param/prim/date" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["scenario"] = scenario unless scenario.nil? - request_headers["value"] = value.to_s unless value.to_s.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get a response with header values "2010-01-01" or "0001-01-01" - # - # @param scenario [String] Send a post request with header values "scenario": - # "valid" or "min" - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def response_date(scenario, custom_headers = nil) - fail ArgumentError, 'scenario is nil' if scenario.nil? - # Construct URL - path = "/header/response/prim/date" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["scenario"] = scenario unless scenario.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Send a post request with header values "scenario": "valid", "value": - # "2010-01-01T12:34:56Z" or "scenario": "min", "value": "0001-01-01T00:00:00Z" - # - # @param scenario [String] Send a post request with header values "scenario": - # "valid" or "min" - # @param value [DateTime] Send a post request with header values - # "2010-01-01T12:34:56Z" or "0001-01-01T00:00:00Z" - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def param_datetime(scenario, value, custom_headers = nil) - fail ArgumentError, 'scenario is nil' if scenario.nil? - fail ArgumentError, 'value is nil' if value.nil? - # Construct URL - path = "/header/param/prim/datetime" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["scenario"] = scenario unless scenario.nil? - request_headers["value"] = value.to_s unless value.to_s.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get a response with header values "2010-01-01T12:34:56Z" or - # "0001-01-01T00:00:00Z" - # - # @param scenario [String] Send a post request with header values "scenario": - # "valid" or "min" - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def response_datetime(scenario, custom_headers = nil) - fail ArgumentError, 'scenario is nil' if scenario.nil? - # Construct URL - path = "/header/response/prim/datetime" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["scenario"] = scenario unless scenario.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Send a post request with header values "scenario": "valid", "value": "Wed, - # 01 Jan 2010 12:34:56 GMT" or "scenario": "min", "value": "Mon, 01 Jan 0001 - # 00:00:00 GMT" - # - # @param scenario [String] Send a post request with header values "scenario": - # "valid" or "min" - # @param value [DateTime] Send a post request with header values "Wed, 01 Jan - # 2010 12:34:56 GMT" or "Mon, 01 Jan 0001 00:00:00 GMT" - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def param_datetime_rfc1123(scenario, value = nil, custom_headers = nil) - fail ArgumentError, 'scenario is nil' if scenario.nil? - # Construct URL - path = "/header/param/prim/datetimerfc1123" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["scenario"] = scenario unless scenario.nil? - request_headers["value"] = value.strftime('%a, %d %b %Y %H:%M:%S GMT') unless value.strftime('%a, %d %b %Y %H:%M:%S GMT').nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get a response with header values "Wed, 01 Jan 2010 12:34:56 GMT" or "Mon, - # 01 Jan 0001 00:00:00 GMT" - # - # @param scenario [String] Send a post request with header values "scenario": - # "valid" or "min" - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def response_datetime_rfc1123(scenario, custom_headers = nil) - fail ArgumentError, 'scenario is nil' if scenario.nil? - # Construct URL - path = "/header/response/prim/datetimerfc1123" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["scenario"] = scenario unless scenario.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Send a post request with header values "scenario": "valid", "value": - # "P123DT22H14M12.011S" - # - # @param scenario [String] Send a post request with header values "scenario": - # "valid" - # @param value [Duration] Send a post request with header values - # "P123DT22H14M12.011S" - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def param_duration(scenario, value, custom_headers = nil) - fail ArgumentError, 'scenario is nil' if scenario.nil? - fail ArgumentError, 'value is nil' if value.nil? - # Construct URL - path = "/header/param/prim/duration" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["scenario"] = scenario unless scenario.nil? - request_headers["value"] = value.to_s unless value.to_s.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get a response with header values "P123DT22H14M12.011S" - # - # @param scenario [String] Send a post request with header values "scenario": - # "valid" - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def response_duration(scenario, custom_headers = nil) - fail ArgumentError, 'scenario is nil' if scenario.nil? - # Construct URL - path = "/header/response/prim/duration" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["scenario"] = scenario unless scenario.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Send a post request with header values "scenario": "valid", "value": - # "啊齄丂狛狜隣郎隣兀﨩" - # - # @param scenario [String] Send a post request with header values "scenario": - # "valid" - # @param value [Array] Send a post request with header values - # "啊齄丂狛狜隣郎隣兀﨩" - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def param_byte(scenario, value, custom_headers = nil) - fail ArgumentError, 'scenario is nil' if scenario.nil? - fail ArgumentError, 'value is nil' if value.nil? - # Construct URL - path = "/header/param/prim/byte" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["scenario"] = scenario unless scenario.nil? - request_headers["value"] = value.to_s unless value.to_s.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get a response with header values "啊齄丂狛狜隣郎隣兀﨩" - # - # @param scenario [String] Send a post request with header values "scenario": - # "valid" - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def response_byte(scenario, custom_headers = nil) - fail ArgumentError, 'scenario is nil' if scenario.nil? - # Construct URL - path = "/header/response/prim/byte" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["scenario"] = scenario unless scenario.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Send a post request with header values "scenario": "valid", "value": "GREY" - # or "scenario": "null", "value": null - # - # @param scenario [String] Send a post request with header values "scenario": - # "valid" or "null" or "empty" - # @param value [GreyscaleColors] Send a post request with header values 'GREY' - # . Possible values for this parameter include: 'White', 'black', 'GREY' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def param_enum(scenario, value = nil, custom_headers = nil) - fail ArgumentError, 'scenario is nil' if scenario.nil? - # Construct URL - path = "/header/param/prim/enum" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["scenario"] = scenario unless scenario.nil? - request_headers["value"] = value.to_s unless value.to_s.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get a response with header values "GREY" or null - # - # @param scenario [String] Send a post request with header values "scenario": - # "valid" or "null" or "empty" - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def response_enum(scenario, custom_headers = nil) - fail ArgumentError, 'scenario is nil' if scenario.nil? - # Construct URL - path = "/header/response/prim/enum" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["scenario"] = scenario unless scenario.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Send x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the - # header of the request - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def custom_request_id(custom_headers = nil) - # Construct URL - path = "/header/custom/x-ms-client-request-id/9C4D50EE-2D56-4CD3-8152-34347DC9F2B0" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/header_folder/header/models/error.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/header_folder/header/models/error.rb deleted file mode 100644 index be6e1e113..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/header_folder/header/models/error.rb +++ /dev/null @@ -1,69 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module HeaderModule - module Models - # - # Model object. - # - class Error - # @return [Integer] - attr_accessor :status - - # @return [String] - attr_accessor :message - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.status - output_object['status'] = serialized_property unless serialized_property.nil? - - serialized_property = object.message - output_object['message'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Error] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Error.new - - deserialized_property = object['status'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.status = deserialized_property - - deserialized_property = object['message'] - output_object.message = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/header_folder/header/models/greyscale_colors.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/header_folder/header/models/greyscale_colors.rb deleted file mode 100644 index d197410d2..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/header_folder/header/models/greyscale_colors.rb +++ /dev/null @@ -1,21 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module HeaderModule - module Models - # - # Defines values for GreyscaleColors - # - module GreyscaleColors - White = "White" - Black = "black" - GREY = "GREY" - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure.rb deleted file mode 100644 index 861325642..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure.rb +++ /dev/null @@ -1,41 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -require 'uri' -require 'cgi' -require 'date' -require 'json' -require 'base64' -require 'erb' -require 'securerandom' -require 'time' -require 'timeliness' -require 'faraday' -require 'faraday-cookie_jar' -require 'concurrent' -require 'ms_rest' - -module HttpInfrastructureModule - autoload :HttpFailure, 'http_infrastructure/http_failure.rb' - autoload :HttpSuccess, 'http_infrastructure/http_success.rb' - autoload :HttpRedirects, 'http_infrastructure/http_redirects.rb' - autoload :HttpClientFailure, 'http_infrastructure/http_client_failure.rb' - autoload :HttpServerFailure, 'http_infrastructure/http_server_failure.rb' - autoload :HttpRetry, 'http_infrastructure/http_retry.rb' - autoload :MultipleResponses, 'http_infrastructure/multiple_responses.rb' - autoload :AutoRestHttpInfrastructureTestService, 'http_infrastructure/auto_rest_http_infrastructure_test_service.rb' - - module Models - autoload :Error, 'http_infrastructure/models/error.rb' - autoload :A, 'http_infrastructure/models/a.rb' - autoload :C, 'http_infrastructure/models/c.rb' - autoload :D, 'http_infrastructure/models/d.rb' - autoload :B, 'http_infrastructure/models/b.rb' - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/auto_rest_http_infrastructure_test_service.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/auto_rest_http_infrastructure_test_service.rb deleted file mode 100644 index 477ccc313..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/auto_rest_http_infrastructure_test_service.rb +++ /dev/null @@ -1,65 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module HttpInfrastructureModule - # - # A service client - single point of access to the REST API. - # - class AutoRestHttpInfrastructureTestService < MsRest::ServiceClient - include HttpInfrastructureModule::Models - - # @return [String] the base URI of the service. - attr_accessor :base_url - - # @return http_failure - attr_reader :http_failure - - # @return http_success - attr_reader :http_success - - # @return http_redirects - attr_reader :http_redirects - - # @return http_client_failure - attr_reader :http_client_failure - - # @return http_server_failure - attr_reader :http_server_failure - - # @return http_retry - attr_reader :http_retry - - # @return multiple_responses - attr_reader :multiple_responses - - # - # Creates initializes a new instance of the AutoRestHttpInfrastructureTestService class. - # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. - # @param base_url [String] the base URI of the service. - # @param options [Array] filters to be applied to the HTTP requests. - # - def initialize(credentials, base_url = nil, options = nil) - super(credentials, options) - @base_url = base_url || 'http://localhost' - - fail ArgumentError, 'credentials is nil' if credentials.nil? - fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) - @credentials = credentials - - @http_failure = HttpFailure.new(self) - @http_success = HttpSuccess.new(self) - @http_redirects = HttpRedirects.new(self) - @http_client_failure = HttpClientFailure.new(self) - @http_server_failure = HttpServerFailure.new(self) - @http_retry = HttpRetry.new(self) - @multiple_responses = MultipleResponses.new(self) - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/http_client_failure.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/http_client_failure.rb deleted file mode 100644 index 2eef2f080..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/http_client_failure.rb +++ /dev/null @@ -1,1579 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module HttpInfrastructureModule - # - # Test Infrastructure for AutoRest - # - class HttpClientFailure - include HttpInfrastructureModule::Models - - # - # Creates and initializes a new instance of the HttpClientFailure class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestHttpInfrastructureTestService - attr_reader :client - - # - # Return 400 status code - should be represented in the client as an error - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def head400(custom_headers = nil) - # Construct URL - path = "/http/failure/client/400" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.head do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Return 400 status code - should be represented in the client as an error - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get400(custom_headers = nil) - # Construct URL - path = "/http/failure/client/400" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Return 400 status code - should be represented in the client as an error - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put400(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/failure/client/400" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Return 400 status code - should be represented in the client as an error - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def patch400(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/failure/client/400" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.patch do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Return 400 status code - should be represented in the client as an error - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post400(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/failure/client/400" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Return 400 status code - should be represented in the client as an error - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def delete400(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/failure/client/400" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Return 401 status code - should be represented in the client as an error - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def head401(custom_headers = nil) - # Construct URL - path = "/http/failure/client/401" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.head do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Return 402 status code - should be represented in the client as an error - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get402(custom_headers = nil) - # Construct URL - path = "/http/failure/client/402" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Return 403 status code - should be represented in the client as an error - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get403(custom_headers = nil) - # Construct URL - path = "/http/failure/client/403" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Return 404 status code - should be represented in the client as an error - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put404(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/failure/client/404" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Return 405 status code - should be represented in the client as an error - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def patch405(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/failure/client/405" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.patch do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Return 406 status code - should be represented in the client as an error - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post406(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/failure/client/406" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Return 407 status code - should be represented in the client as an error - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def delete407(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/failure/client/407" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Return 409 status code - should be represented in the client as an error - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put409(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/failure/client/409" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Return 410 status code - should be represented in the client as an error - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def head410(custom_headers = nil) - # Construct URL - path = "/http/failure/client/410" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.head do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Return 411 status code - should be represented in the client as an error - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get411(custom_headers = nil) - # Construct URL - path = "/http/failure/client/411" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Return 412 status code - should be represented in the client as an error - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get412(custom_headers = nil) - # Construct URL - path = "/http/failure/client/412" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Return 413 status code - should be represented in the client as an error - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put413(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/failure/client/413" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Return 414 status code - should be represented in the client as an error - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def patch414(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/failure/client/414" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.patch do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Return 415 status code - should be represented in the client as an error - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post415(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/failure/client/415" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Return 416 status code - should be represented in the client as an error - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get416(custom_headers = nil) - # Construct URL - path = "/http/failure/client/416" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Return 417 status code - should be represented in the client as an error - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def delete417(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/failure/client/417" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Return 429 status code - should be represented in the client as an error - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def head429(custom_headers = nil) - # Construct URL - path = "/http/failure/client/429" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.head do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/http_failure.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/http_failure.rb deleted file mode 100644 index e83cf750b..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/http_failure.rb +++ /dev/null @@ -1,93 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module HttpInfrastructureModule - # - # Test Infrastructure for AutoRest - # - class HttpFailure - include HttpInfrastructureModule::Models - - # - # Creates and initializes a new instance of the HttpFailure class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestHttpInfrastructureTestService - attr_reader :client - - # - # Get empty error form server - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_empty_error(custom_headers = nil) - # Construct URL - path = "/http/failure/emptybody/error" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/http_redirects.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/http_redirects.rb deleted file mode 100644 index 62a9e33b4..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/http_redirects.rb +++ /dev/null @@ -1,910 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module HttpInfrastructureModule - # - # Test Infrastructure for AutoRest - # - class HttpRedirects - include HttpInfrastructureModule::Models - - # - # Creates and initializes a new instance of the HttpRedirects class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestHttpInfrastructureTestService - attr_reader :client - - # - # Return 300 status code and redirect to /http/success/200 - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def head300(custom_headers = nil) - # Construct URL - path = "/http/redirect/300" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.head do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Return 300 status code and redirect to /http/success/200 - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get300(custom_headers = nil) - # Construct URL - path = "/http/redirect/300" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 300 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Return 301 status code and redirect to /http/success/200 - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def head301(custom_headers = nil) - # Construct URL - path = "/http/redirect/301" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.head do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 301) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Return 301 status code and redirect to /http/success/200 - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get301(custom_headers = nil) - # Construct URL - path = "/http/redirect/301" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 301) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Put true Boolean value in request returns 301. This request should not be - # automatically redirected, but should return the received 301 to the caller - # for evaluation - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put301(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/redirect/301" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 301) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Return 302 status code and redirect to /http/success/200 - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def head302(custom_headers = nil) - # Construct URL - path = "/http/redirect/302" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.head do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 302) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Return 302 status code and redirect to /http/success/200 - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get302(custom_headers = nil) - # Construct URL - path = "/http/redirect/302" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 302) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Patch true Boolean value in request returns 302. This request should not be - # automatically redirected, but should return the received 302 to the caller - # for evaluation - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def patch302(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/redirect/302" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.patch do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 302) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Post true Boolean value in request returns 303. This request should be - # automatically redirected usign a get, ultimately returning a 200 status code - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post303(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/redirect/303" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 303) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Redirect with 307, resulting in a 200 success - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def head307(custom_headers = nil) - # Construct URL - path = "/http/redirect/307" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.head do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 307) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Redirect get with 307, resulting in a 200 success - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get307(custom_headers = nil) - # Construct URL - path = "/http/redirect/307" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 307) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Put redirected with 307, resulting in a 200 after redirect - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put307(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/redirect/307" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 307) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Patch redirected with 307, resulting in a 200 after redirect - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def patch307(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/redirect/307" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.patch do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 307) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Post redirected with 307, resulting in a 200 after redirect - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post307(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/redirect/307" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 307) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Delete redirected with 307, resulting in a 200 after redirect - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def delete307(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/redirect/307" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 307) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/http_retry.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/http_retry.rb deleted file mode 100644 index ff644f489..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/http_retry.rb +++ /dev/null @@ -1,505 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module HttpInfrastructureModule - # - # Test Infrastructure for AutoRest - # - class HttpRetry - include HttpInfrastructureModule::Models - - # - # Creates and initializes a new instance of the HttpRetry class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestHttpInfrastructureTestService - attr_reader :client - - # - # Return 408 status code, then 200 after retry - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def head408(custom_headers = nil) - # Construct URL - path = "/http/retry/408" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.head do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Return 500 status code, then 200 after retry - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put500(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/retry/500" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Return 500 status code, then 200 after retry - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def patch500(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/retry/500" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.patch do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Return 502 status code, then 200 after retry - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get502(custom_headers = nil) - # Construct URL - path = "/http/retry/502" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Return 503 status code, then 200 after retry - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post503(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/retry/503" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Return 503 status code, then 200 after retry - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def delete503(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/retry/503" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Return 504 status code, then 200 after retry - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put504(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/retry/504" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Return 504 status code, then 200 after retry - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def patch504(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/retry/504" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.patch do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/http_server_failure.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/http_server_failure.rb deleted file mode 100644 index 3003c9bee..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/http_server_failure.rb +++ /dev/null @@ -1,297 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module HttpInfrastructureModule - # - # Test Infrastructure for AutoRest - # - class HttpServerFailure - include HttpInfrastructureModule::Models - - # - # Creates and initializes a new instance of the HttpServerFailure class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestHttpInfrastructureTestService - attr_reader :client - - # - # Return 501 status code - should be represented in the client as an error - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def head501(custom_headers = nil) - # Construct URL - path = "/http/failure/server/501" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.head do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Return 501 status code - should be represented in the client as an error - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get501(custom_headers = nil) - # Construct URL - path = "/http/failure/server/501" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Return 505 status code - should be represented in the client as an error - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post505(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/failure/server/505" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Return 505 status code - should be represented in the client as an error - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def delete505(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/failure/server/505" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/http_success.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/http_success.rb deleted file mode 100644 index 3b64a01f8..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/http_success.rb +++ /dev/null @@ -1,1112 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module HttpInfrastructureModule - # - # Test Infrastructure for AutoRest - # - class HttpSuccess - include HttpInfrastructureModule::Models - - # - # Creates and initializes a new instance of the HttpSuccess class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestHttpInfrastructureTestService - attr_reader :client - - # - # Return 200 status code if successful - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def head200(custom_headers = nil) - # Construct URL - path = "/http/success/200" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.head do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get 200 success - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get200(custom_headers = nil) - # Construct URL - path = "/http/success/200" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put boolean value true returning 200 success - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put200(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/success/200" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Patch true Boolean value in request returning 200 - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def patch200(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/success/200" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.patch do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Post bollean value true in request that returns a 200 - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post200(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/success/200" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Delete simple boolean value true returns 200 - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def delete200(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/success/200" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Put true Boolean value in request returns 201 - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put201(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/success/201" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 201) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Post true Boolean value in request returns 201 (Created) - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post201(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/success/201" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 201) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Put true Boolean value in request returns 202 (Accepted) - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put202(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/success/202" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Patch true Boolean value in request returns 202 - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def patch202(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/success/202" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.patch do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Post true Boolean value in request returns 202 (Accepted) - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post202(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/success/202" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Delete true Boolean value in request returns 202 (accepted) - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def delete202(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/success/202" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Return 204 status code if successful - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def head204(custom_headers = nil) - # Construct URL - path = "/http/success/204" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.head do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 204) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Put true Boolean value in request returns 204 (no content) - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put204(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/success/204" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 204) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Patch true Boolean value in request returns 204 (no content) - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def patch204(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/success/204" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.patch do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 204) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Post true Boolean value in request returns 204 (no content) - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post204(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/success/204" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 204) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Delete true Boolean value in request returns 204 (no content) - # - # @param boolean_value [Boolean] Simple boolean value true - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def delete204(boolean_value = nil, custom_headers = nil) - # Construct URL - path = "/http/success/204" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(boolean_value, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.delete do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 204) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Return 404 status code - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def head404(custom_headers = nil) - # Construct URL - path = "/http/success/404" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.head do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 204 || status_code == 404) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/models/a.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/models/a.rb deleted file mode 100644 index 45f554c7f..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/models/a.rb +++ /dev/null @@ -1,59 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module HttpInfrastructureModule - module Models - # - # Model object. - # - class A - # @return [String] - attr_accessor :status_code - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.status_code - output_object['statusCode'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [A] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = A.new - - deserialized_property = object['statusCode'] - output_object.status_code = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/models/b.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/models/b.rb deleted file mode 100644 index 0d9c54371..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/models/b.rb +++ /dev/null @@ -1,65 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module HttpInfrastructureModule - module Models - # - # Model object. - # - class B < A - # @return [String] - attr_accessor :text_status_code - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.status_code - output_object['statusCode'] = serialized_property unless serialized_property.nil? - - serialized_property = object.text_status_code - output_object['textStatusCode'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [B] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = B.new - - deserialized_property = object['statusCode'] - output_object.status_code = deserialized_property - - deserialized_property = object['textStatusCode'] - output_object.text_status_code = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/models/c.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/models/c.rb deleted file mode 100644 index 9c1b66fb9..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/models/c.rb +++ /dev/null @@ -1,59 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module HttpInfrastructureModule - module Models - # - # Model object. - # - class C - # @return [String] - attr_accessor :http_code - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.http_code - output_object['httpCode'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [C] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = C.new - - deserialized_property = object['httpCode'] - output_object.http_code = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/models/d.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/models/d.rb deleted file mode 100644 index f5cb8fd7b..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/models/d.rb +++ /dev/null @@ -1,59 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module HttpInfrastructureModule - module Models - # - # Model object. - # - class D - # @return [String] - attr_accessor :http_status_code - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.http_status_code - output_object['httpStatusCode'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [D] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = D.new - - deserialized_property = object['httpStatusCode'] - output_object.http_status_code = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/models/error.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/models/error.rb deleted file mode 100644 index afbc37f11..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/models/error.rb +++ /dev/null @@ -1,69 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module HttpInfrastructureModule - module Models - # - # Model object. - # - class Error - # @return [Integer] - attr_accessor :status - - # @return [String] - attr_accessor :message - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.status - output_object['status'] = serialized_property unless serialized_property.nil? - - serialized_property = object.message - output_object['message'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Error] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Error.new - - deserialized_property = object['status'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.status = deserialized_property - - deserialized_property = object['message'] - output_object.message = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/multiple_responses.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/multiple_responses.rb deleted file mode 100644 index b03f96b37..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/http_infrastructure/http_infrastructure/multiple_responses.rb +++ /dev/null @@ -1,2287 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module HttpInfrastructureModule - # - # Test Infrastructure for AutoRest - # - class MultipleResponses - include HttpInfrastructureModule::Models - - # - # Creates and initializes a new instance of the MultipleResponses class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestHttpInfrastructureTestService - attr_reader :client - - # - # Send a 200 response with valid payload: {'statusCode': '200'} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get200model204no_model_default_error200valid(custom_headers = nil) - # Construct URL - path = "/http/payloads/200/A/204/none/default/Error/response/200/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 204) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = A.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Send a 204 response with no payload - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get200model204no_model_default_error204valid(custom_headers = nil) - # Construct URL - path = "/http/payloads/200/A/204/none/default/Error/response/204/none" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 204) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = A.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Send a 201 response with valid payload: {'statusCode': '201'} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get200model204no_model_default_error201invalid(custom_headers = nil) - # Construct URL - path = "/http/payloads/200/A/204/none/default/Error/response/201/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 204) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = A.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Send a 202 response with no payload: - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get200model204no_model_default_error202none(custom_headers = nil) - # Construct URL - path = "/http/payloads/200/A/204/none/default/Error/response/202/none" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 204) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = A.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Send a 400 response with valid error payload: {'status': 400, 'message': - # 'client error'} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get200model204no_model_default_error400valid(custom_headers = nil) - # Construct URL - path = "/http/payloads/200/A/204/none/default/Error/response/400/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 204) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = A.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Send a 200 response with valid payload: {'statusCode': '200'} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get200model201model_default_error200valid(custom_headers = nil) - # Construct URL - path = "/http/payloads/200/A/201/B/default/Error/response/200/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 201) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = A.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - # Deserialize Response - if status_code == 201 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = B.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Send a 201 response with valid payload: {'statusCode': '201', - # 'textStatusCode': 'Created'} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get200model201model_default_error201valid(custom_headers = nil) - # Construct URL - path = "/http/payloads/200/A/201/B/default/Error/response/201/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 201) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = A.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - # Deserialize Response - if status_code == 201 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = B.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Send a 400 response with valid payload: {'code': '400', 'message': 'client - # error'} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get200model201model_default_error400valid(custom_headers = nil) - # Construct URL - path = "/http/payloads/200/A/201/B/default/Error/response/400/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 201) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = A.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - # Deserialize Response - if status_code == 201 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = B.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Send a 200 response with valid payload: {'statusCode': '200'} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get200model_a201model_c404model_ddefault_error200valid(custom_headers = nil) - # Construct URL - path = "/http/payloads/200/A/201/C/404/D/default/Error/response/200/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 201 || status_code == 404) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = A.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - # Deserialize Response - if status_code == 201 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = C.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - # Deserialize Response - if status_code == 404 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = D.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Send a 200 response with valid payload: {'httpCode': '201'} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get200model_a201model_c404model_ddefault_error201valid(custom_headers = nil) - # Construct URL - path = "/http/payloads/200/A/201/C/404/D/default/Error/response/201/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 201 || status_code == 404) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = A.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - # Deserialize Response - if status_code == 201 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = C.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - # Deserialize Response - if status_code == 404 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = D.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Send a 200 response with valid payload: {'httpStatusCode': '404'} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get200model_a201model_c404model_ddefault_error404valid(custom_headers = nil) - # Construct URL - path = "/http/payloads/200/A/201/C/404/D/default/Error/response/404/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 201 || status_code == 404) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = A.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - # Deserialize Response - if status_code == 201 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = C.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - # Deserialize Response - if status_code == 404 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = D.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Send a 400 response with valid payload: {'code': '400', 'message': 'client - # error'} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get200model_a201model_c404model_ddefault_error400valid(custom_headers = nil) - # Construct URL - path = "/http/payloads/200/A/201/C/404/D/default/Error/response/400/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200 || status_code == 201 || status_code == 404) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = A.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - # Deserialize Response - if status_code == 201 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = C.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - # Deserialize Response - if status_code == 404 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = D.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Send a 202 response with no payload - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get202none204none_default_error202none(custom_headers = nil) - # Construct URL - path = "/http/payloads/202/none/204/none/default/Error/response/202/none" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202 || status_code == 204) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Send a 204 response with no payload - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get202none204none_default_error204none(custom_headers = nil) - # Construct URL - path = "/http/payloads/202/none/204/none/default/Error/response/204/none" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202 || status_code == 204) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Send a 400 response with valid payload: {'code': '400', 'message': 'client - # error'} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get202none204none_default_error400valid(custom_headers = nil) - # Construct URL - path = "/http/payloads/202/none/204/none/default/Error/response/400/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202 || status_code == 204) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Send a 202 response with an unexpected payload {'property': 'value'} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get202none204none_default_none202invalid(custom_headers = nil) - # Construct URL - path = "/http/payloads/202/none/204/none/default/none/response/202/invalid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202 || status_code == 204) - fail MsRest::HttpOperationError.new(connection, http_response) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Send a 204 response with no payload - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get202none204none_default_none204none(custom_headers = nil) - # Construct URL - path = "/http/payloads/202/none/204/none/default/none/response/204/none" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202 || status_code == 204) - fail MsRest::HttpOperationError.new(connection, http_response) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Send a 400 response with no payload - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get202none204none_default_none400none(custom_headers = nil) - # Construct URL - path = "/http/payloads/202/none/204/none/default/none/response/400/none" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202 || status_code == 204) - fail MsRest::HttpOperationError.new(connection, http_response) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Send a 400 response with an unexpected payload {'property': 'value'} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get202none204none_default_none400invalid(custom_headers = nil) - # Construct URL - path = "/http/payloads/202/none/204/none/default/none/response/400/invalid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 202 || status_code == 204) - fail MsRest::HttpOperationError.new(connection, http_response) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Send a 200 response with valid payload: {'statusCode': '200'} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_default_model_a200valid(custom_headers = nil) - # Construct URL - path = "/http/payloads/default/A/response/200/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = A.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Send a 200 response with no payload - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_default_model_a200none(custom_headers = nil) - # Construct URL - path = "/http/payloads/default/A/response/200/none" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = A.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Send a 400 response with valid payload: {'statusCode': '400'} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_default_model_a400valid(custom_headers = nil) - # Construct URL - path = "/http/payloads/default/A/response/400/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = A.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Send a 400 response with no payload - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_default_model_a400none(custom_headers = nil) - # Construct URL - path = "/http/payloads/default/A/response/400/none" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = A.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Send a 200 response with invalid payload: {'statusCode': '200'} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_default_none200invalid(custom_headers = nil) - # Construct URL - path = "/http/payloads/default/none/response/200/invalid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - fail MsRest::HttpOperationError.new(connection, http_response) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Send a 200 response with no payload - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_default_none200none(custom_headers = nil) - # Construct URL - path = "/http/payloads/default/none/response/200/none" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - fail MsRest::HttpOperationError.new(connection, http_response) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Send a 400 response with valid payload: {'statusCode': '400'} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_default_none400invalid(custom_headers = nil) - # Construct URL - path = "/http/payloads/default/none/response/400/invalid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - fail MsRest::HttpOperationError.new(connection, http_response) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Send a 400 response with no payload - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_default_none400none(custom_headers = nil) - # Construct URL - path = "/http/payloads/default/none/response/400/none" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - fail MsRest::HttpOperationError.new(connection, http_response) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Send a 200 response with no payload, when a payload is expected - client - # should return a null object of thde type for model A - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get200model_a200none(custom_headers = nil) - # Construct URL - path = "/http/payloads/200/A/response/200/none" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - fail MsRest::HttpOperationError.new(connection, http_response) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = A.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Send a 200 response with payload {'statusCode': '200'} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get200model_a200valid(custom_headers = nil) - # Construct URL - path = "/http/payloads/200/A/response/200/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - fail MsRest::HttpOperationError.new(connection, http_response) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = A.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Send a 200 response with invalid payload {'statusCodeInvalid': '200'} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get200model_a200invalid(custom_headers = nil) - # Construct URL - path = "/http/payloads/200/A/response/200/invalid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - fail MsRest::HttpOperationError.new(connection, http_response) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = A.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Send a 400 response with no payload client should treat as an http error - # with no error model - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get200model_a400none(custom_headers = nil) - # Construct URL - path = "/http/payloads/200/A/response/400/none" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - fail MsRest::HttpOperationError.new(connection, http_response) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = A.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Send a 200 response with payload {'statusCode': '400'} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get200model_a400valid(custom_headers = nil) - # Construct URL - path = "/http/payloads/200/A/response/400/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - fail MsRest::HttpOperationError.new(connection, http_response) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = A.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Send a 200 response with invalid payload {'statusCodeInvalid': '400'} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get200model_a400invalid(custom_headers = nil) - # Construct URL - path = "/http/payloads/200/A/response/400/invalid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - fail MsRest::HttpOperationError.new(connection, http_response) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = A.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Send a 202 response with payload {'statusCode': '202'} - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get200model_a202valid(custom_headers = nil) - # Construct URL - path = "/http/payloads/200/A/response/202/valid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - fail MsRest::HttpOperationError.new(connection, http_response) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = A.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/integer/body_integer.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/integer/body_integer.rb deleted file mode 100644 index fc97a4cab..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/integer/body_integer.rb +++ /dev/null @@ -1,31 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -require 'uri' -require 'cgi' -require 'date' -require 'json' -require 'base64' -require 'erb' -require 'securerandom' -require 'time' -require 'timeliness' -require 'faraday' -require 'faraday-cookie_jar' -require 'concurrent' -require 'ms_rest' - -module IntegerModule - autoload :Int, 'body_integer/int.rb' - autoload :AutoRestIntegerTestService, 'body_integer/auto_rest_integer_test_service.rb' - - module Models - autoload :Error, 'body_integer/models/error.rb' - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/integer/body_integer/auto_rest_integer_test_service.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/integer/body_integer/auto_rest_integer_test_service.rb deleted file mode 100644 index 27a8b1a88..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/integer/body_integer/auto_rest_integer_test_service.rb +++ /dev/null @@ -1,41 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module IntegerModule - # - # A service client - single point of access to the REST API. - # - class AutoRestIntegerTestService < MsRest::ServiceClient - include IntegerModule::Models - - # @return [String] the base URI of the service. - attr_accessor :base_url - - # @return int - attr_reader :int - - # - # Creates initializes a new instance of the AutoRestIntegerTestService class. - # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. - # @param base_url [String] the base URI of the service. - # @param options [Array] filters to be applied to the HTTP requests. - # - def initialize(credentials, base_url = nil, options = nil) - super(credentials, options) - @base_url = base_url || 'https://localhost' - - fail ArgumentError, 'credentials is nil' if credentials.nil? - fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) - @credentials = credentials - - @int = Int.new(self) - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/integer/body_integer/int.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/integer/body_integer/int.rb deleted file mode 100644 index 447a6045c..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/integer/body_integer/int.rb +++ /dev/null @@ -1,667 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module IntegerModule - # - # Test Infrastructure for AutoRest - # - class Int - include IntegerModule::Models - - # - # Creates and initializes a new instance of the Int class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestIntegerTestService - attr_reader :client - - # - # Get null Int value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_null(custom_headers = nil) - # Construct URL - path = "/int/null" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = Integer(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get invalid Int value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_invalid(custom_headers = nil) - # Construct URL - path = "/int/invalid" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = Integer(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get overflow Int32 value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_overflow_int32(custom_headers = nil) - # Construct URL - path = "/int/overflowint32" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = Integer(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get underflow Int32 value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_underflow_int32(custom_headers = nil) - # Construct URL - path = "/int/underflowint32" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = Integer(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get overflow Int64 value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_overflow_int64(custom_headers = nil) - # Construct URL - path = "/int/overflowint64" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = Integer(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get underflow Int64 value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_underflow_int64(custom_headers = nil) - # Construct URL - path = "/int/underflowint64" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = Integer(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put max int32 value - # - # @param int_body [Integer] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_max32(int_body, custom_headers = nil) - fail ArgumentError, 'int_body is nil' if int_body.nil? - # Construct URL - path = "/int/max/32" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(int_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Put max int64 value - # - # @param int_body [Integer] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_max64(int_body, custom_headers = nil) - fail ArgumentError, 'int_body is nil' if int_body.nil? - # Construct URL - path = "/int/max/64" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(int_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Put min int32 value - # - # @param int_body [Integer] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_min32(int_body, custom_headers = nil) - fail ArgumentError, 'int_body is nil' if int_body.nil? - # Construct URL - path = "/int/min/32" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(int_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Put min int64 value - # - # @param int_body [Integer] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_min64(int_body, custom_headers = nil) - fail ArgumentError, 'int_body is nil' if int_body.nil? - # Construct URL - path = "/int/min/64" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(int_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/integer/body_integer/models/error.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/integer/body_integer/models/error.rb deleted file mode 100644 index 6b3a3b98c..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/integer/body_integer/models/error.rb +++ /dev/null @@ -1,69 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module IntegerModule - module Models - # - # Model object. - # - class Error - # @return [Integer] - attr_accessor :status - - # @return [String] - attr_accessor :message - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.status - output_object['status'] = serialized_property unless serialized_property.nil? - - serialized_property = object.message - output_object['message'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Error] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Error.new - - deserialized_property = object['status'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.status = deserialized_property - - deserialized_property = object['message'] - output_object.message = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/number/body_number.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/number/body_number.rb deleted file mode 100644 index 82e18c1cc..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/number/body_number.rb +++ /dev/null @@ -1,31 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -require 'uri' -require 'cgi' -require 'date' -require 'json' -require 'base64' -require 'erb' -require 'securerandom' -require 'time' -require 'timeliness' -require 'faraday' -require 'faraday-cookie_jar' -require 'concurrent' -require 'ms_rest' - -module NumberModule - autoload :Number, 'body_number/number.rb' - autoload :AutoRestNumberTestService, 'body_number/auto_rest_number_test_service.rb' - - module Models - autoload :Error, 'body_number/models/error.rb' - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/number/body_number/auto_rest_number_test_service.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/number/body_number/auto_rest_number_test_service.rb deleted file mode 100644 index 9a5f17af5..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/number/body_number/auto_rest_number_test_service.rb +++ /dev/null @@ -1,41 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module NumberModule - # - # A service client - single point of access to the REST API. - # - class AutoRestNumberTestService < MsRest::ServiceClient - include NumberModule::Models - - # @return [String] the base URI of the service. - attr_accessor :base_url - - # @return number - attr_reader :number - - # - # Creates initializes a new instance of the AutoRestNumberTestService class. - # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. - # @param base_url [String] the base URI of the service. - # @param options [Array] filters to be applied to the HTTP requests. - # - def initialize(credentials, base_url = nil, options = nil) - super(credentials, options) - @base_url = base_url || 'https://localhost' - - fail ArgumentError, 'credentials is nil' if credentials.nil? - fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) - @credentials = credentials - - @number = Number.new(self) - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/number/body_number/models/error.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/number/body_number/models/error.rb deleted file mode 100644 index 3b8dcc414..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/number/body_number/models/error.rb +++ /dev/null @@ -1,69 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module NumberModule - module Models - # - # Model object. - # - class Error - # @return [Integer] - attr_accessor :status - - # @return [String] - attr_accessor :message - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.status - output_object['status'] = serialized_property unless serialized_property.nil? - - serialized_property = object.message - output_object['message'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Error] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Error.new - - deserialized_property = object['status'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.status = deserialized_property - - deserialized_property = object['message'] - output_object.message = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/number/body_number/number.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/number/body_number/number.rb deleted file mode 100644 index 073c34e03..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/number/body_number/number.rb +++ /dev/null @@ -1,1554 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module NumberModule - # - # Test Infrastructure for AutoRest - # - class Number - include NumberModule::Models - - # - # Creates and initializes a new instance of the Number class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestNumberTestService - attr_reader :client - - # - # Get null Number value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_null(custom_headers = nil) - # Construct URL - path = "/number/null" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = Float(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get invalid float Number value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_invalid_float(custom_headers = nil) - # Construct URL - path = "/number/invalidfloat" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = Float(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get invalid double Number value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_invalid_double(custom_headers = nil) - # Construct URL - path = "/number/invaliddouble" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = Float(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Get invalid decimal Number value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_invalid_decimal(custom_headers = nil) - # Construct URL - path = "/number/invaliddecimal" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put big float value 3.402823e+20 - # - # @param number_body [Float] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_big_float(number_body, custom_headers = nil) - fail ArgumentError, 'number_body is nil' if number_body.nil? - # Construct URL - path = "/number/big/float/3.402823e+20" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(number_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get big float value 3.402823e+20 - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_big_float(custom_headers = nil) - # Construct URL - path = "/number/big/float/3.402823e+20" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = Float(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put big double value 2.5976931e+101 - # - # @param number_body [Float] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_big_double(number_body, custom_headers = nil) - fail ArgumentError, 'number_body is nil' if number_body.nil? - # Construct URL - path = "/number/big/double/2.5976931e+101" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(number_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get big double value 2.5976931e+101 - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_big_double(custom_headers = nil) - # Construct URL - path = "/number/big/double/2.5976931e+101" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = Float(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put big double value 99999999.99 - # - # @param number_body [Float] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_big_double_positive_decimal(number_body, custom_headers = nil) - fail ArgumentError, 'number_body is nil' if number_body.nil? - # Construct URL - path = "/number/big/double/99999999.99" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(number_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get big double value 99999999.99 - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_big_double_positive_decimal(custom_headers = nil) - # Construct URL - path = "/number/big/double/99999999.99" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = Float(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put big double value -99999999.99 - # - # @param number_body [Float] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_big_double_negative_decimal(number_body, custom_headers = nil) - fail ArgumentError, 'number_body is nil' if number_body.nil? - # Construct URL - path = "/number/big/double/-99999999.99" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(number_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get big double value -99999999.99 - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_big_double_negative_decimal(custom_headers = nil) - # Construct URL - path = "/number/big/double/-99999999.99" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = Float(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put big decimal value 2.5976931e+101 - # - # @param number_body - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_big_decimal(number_body, custom_headers = nil) - fail ArgumentError, 'number_body is nil' if number_body.nil? - # Construct URL - path = "/number/big/decimal/2.5976931e+101" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(number_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get big decimal value 2.5976931e+101 - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_big_decimal(custom_headers = nil) - # Construct URL - path = "/number/big/decimal/2.5976931e+101" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put big decimal value 99999999.99 - # - # @param number_body - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_big_decimal_positive_decimal(number_body, custom_headers = nil) - fail ArgumentError, 'number_body is nil' if number_body.nil? - # Construct URL - path = "/number/big/decimal/99999999.99" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(number_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get big decimal value 99999999.99 - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_big_decimal_positive_decimal(custom_headers = nil) - # Construct URL - path = "/number/big/decimal/99999999.99" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put big decimal value -99999999.99 - # - # @param number_body - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_big_decimal_negative_decimal(number_body, custom_headers = nil) - fail ArgumentError, 'number_body is nil' if number_body.nil? - # Construct URL - path = "/number/big/decimal/-99999999.99" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(number_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get big decimal value -99999999.99 - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_big_decimal_negative_decimal(custom_headers = nil) - # Construct URL - path = "/number/big/decimal/-99999999.99" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put small float value 3.402823e-20 - # - # @param number_body [Float] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_small_float(number_body, custom_headers = nil) - fail ArgumentError, 'number_body is nil' if number_body.nil? - # Construct URL - path = "/number/small/float/3.402823e-20" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(number_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get big double value 3.402823e-20 - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_small_float(custom_headers = nil) - # Construct URL - path = "/number/small/float/3.402823e-20" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = Float(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put small double value 2.5976931e-101 - # - # @param number_body [Float] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_small_double(number_body, custom_headers = nil) - fail ArgumentError, 'number_body is nil' if number_body.nil? - # Construct URL - path = "/number/small/double/2.5976931e-101" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(number_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get big double value 2.5976931e-101 - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_small_double(custom_headers = nil) - # Construct URL - path = "/number/small/double/2.5976931e-101" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - parsed_response = Float(parsed_response) unless parsed_response.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Put small decimal value 2.5976931e-101 - # - # @param number_body - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_small_decimal(number_body, custom_headers = nil) - fail ArgumentError, 'number_body is nil' if number_body.nil? - # Construct URL - path = "/number/small/decimal/2.5976931e-101" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(number_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get small decimal value 2.5976931e-101 - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_small_decimal(custom_headers = nil) - # Construct URL - path = "/number/small/decimal/2.5976931e-101" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/report/report.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/report/report.rb deleted file mode 100644 index 963438911..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/report/report.rb +++ /dev/null @@ -1,30 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -require 'uri' -require 'cgi' -require 'date' -require 'json' -require 'base64' -require 'erb' -require 'securerandom' -require 'time' -require 'timeliness' -require 'faraday' -require 'faraday-cookie_jar' -require 'concurrent' -require 'ms_rest' - -module ReportModule - autoload :AutoRestReportService, 'report/auto_rest_report_service.rb' - - module Models - autoload :Error, 'report/models/error.rb' - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/report/report/auto_rest_report_service.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/report/report/auto_rest_report_service.rb deleted file mode 100644 index e45ba6e3a..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/report/report/auto_rest_report_service.rb +++ /dev/null @@ -1,107 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ReportModule - # - # A service client - single point of access to the REST API. - # - class AutoRestReportService < MsRest::ServiceClient - include ReportModule::Models - - # @return [String] the base URI of the service. - attr_accessor :base_url - - # - # Creates initializes a new instance of the AutoRestReportService class. - # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. - # @param base_url [String] the base URI of the service. - # @param options [Array] filters to be applied to the HTTP requests. - # - def initialize(credentials, base_url = nil, options = nil) - super(credentials, options) - @base_url = base_url || 'http://localhost' - - fail ArgumentError, 'credentials is nil' if credentials.nil? - fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) - @credentials = credentials - - end - - # - # Get test coverage report - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_report(custom_headers = nil) - # Construct URL - path = "/report" - url = URI.join(self.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - self.credentials.sign_request(request) unless self.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response.each do |key, valueElement| - valueElement = Integer(valueElement) unless valueElement.to_s.empty? - parsed_response[key] = valueElement - end - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/report/report/models/error.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/report/report/models/error.rb deleted file mode 100644 index e4e7187cb..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/report/report/models/error.rb +++ /dev/null @@ -1,69 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module ReportModule - module Models - # - # Model object. - # - class Error - # @return [Integer] - attr_accessor :status - - # @return [String] - attr_accessor :message - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.status - output_object['status'] = serialized_property unless serialized_property.nil? - - serialized_property = object.message - output_object['message'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Error] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Error.new - - deserialized_property = object['status'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.status = deserialized_property - - deserialized_property = object['message'] - output_object.message = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional.rb deleted file mode 100644 index 46cf5ac1f..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional.rb +++ /dev/null @@ -1,41 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -require 'uri' -require 'cgi' -require 'date' -require 'json' -require 'base64' -require 'erb' -require 'securerandom' -require 'time' -require 'timeliness' -require 'faraday' -require 'faraday-cookie_jar' -require 'concurrent' -require 'ms_rest' - -module RequiredOptionalModule - autoload :Implicit, 'required_optional/implicit.rb' - autoload :Explicit, 'required_optional/explicit.rb' - autoload :AutoRestRequiredOptionalTestService, 'required_optional/auto_rest_required_optional_test_service.rb' - - module Models - autoload :Error, 'required_optional/models/error.rb' - autoload :IntWrapper, 'required_optional/models/int_wrapper.rb' - autoload :IntOptionalWrapper, 'required_optional/models/int_optional_wrapper.rb' - autoload :StringWrapper, 'required_optional/models/string_wrapper.rb' - autoload :StringOptionalWrapper, 'required_optional/models/string_optional_wrapper.rb' - autoload :ArrayWrapper, 'required_optional/models/array_wrapper.rb' - autoload :ArrayOptionalWrapper, 'required_optional/models/array_optional_wrapper.rb' - autoload :ClassWrapper, 'required_optional/models/class_wrapper.rb' - autoload :Product, 'required_optional/models/product.rb' - autoload :ClassOptionalWrapper, 'required_optional/models/class_optional_wrapper.rb' - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/auto_rest_required_optional_test_service.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/auto_rest_required_optional_test_service.rb deleted file mode 100644 index 5a1347f5d..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/auto_rest_required_optional_test_service.rb +++ /dev/null @@ -1,54 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module RequiredOptionalModule - # - # A service client - single point of access to the REST API. - # - class AutoRestRequiredOptionalTestService < MsRest::ServiceClient - include RequiredOptionalModule::Models - - # @return [String] the base URI of the service. - attr_accessor :base_url - - # @return [String] number of items to skip - attr_accessor :required_global_path - - # @return [String] number of items to skip - attr_accessor :required_global_query - - # @return [Integer] number of items to skip - attr_accessor :optional_global_query - - # @return implicit - attr_reader :implicit - - # @return explicit - attr_reader :explicit - - # - # Creates initializes a new instance of the AutoRestRequiredOptionalTestService class. - # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. - # @param base_url [String] the base URI of the service. - # @param options [Array] filters to be applied to the HTTP requests. - # - def initialize(credentials, base_url = nil, options = nil) - super(credentials, options) - @base_url = base_url || 'http://localhost' - - fail ArgumentError, 'credentials is nil' if credentials.nil? - fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) - @credentials = credentials - - @implicit = Implicit.new(self) - @explicit = Explicit.new(self) - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/explicit.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/explicit.rb deleted file mode 100644 index 557e81ad5..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/explicit.rb +++ /dev/null @@ -1,1535 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module RequiredOptionalModule - # - # Test Infrastructure for AutoRest - # - class Explicit - include RequiredOptionalModule::Models - - # - # Creates and initializes a new instance of the Explicit class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestRequiredOptionalTestService - attr_reader :client - - # - # Test explicitly required integer. Please put null and the client library - # should throw before the request is sent. - # - # @param body_parameter [Integer] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post_required_integer_parameter(body_parameter, custom_headers = nil) - fail ArgumentError, 'body_parameter is nil' if body_parameter.nil? - # Construct URL - path = "/reqopt/requied/integer/parameter" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(body_parameter, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Test explicitly optional integer. Please put null. - # - # @param body_parameter [Integer] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post_optional_integer_parameter(body_parameter = nil, custom_headers = nil) - # Construct URL - path = "/reqopt/optional/integer/parameter" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(body_parameter, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Test explicitly required integer. Please put a valid int-wrapper with - # 'value' = null and the client library should throw before the request is - # sent. - # - # @param body_parameter [IntWrapper] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post_required_integer_property(body_parameter, custom_headers = nil) - fail ArgumentError, 'body_parameter is nil' if body_parameter.nil? - body_parameter.validate unless body_parameter.nil? - # Construct URL - path = "/reqopt/requied/integer/property" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless body_parameter.nil? - body_parameter = IntWrapper.serialize_object(body_parameter) - end - request_content = JSON.generate(body_parameter, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Test explicitly optional integer. Please put a valid int-wrapper with - # 'value' = null. - # - # @param body_parameter [IntOptionalWrapper] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post_optional_integer_property(body_parameter = nil, custom_headers = nil) - body_parameter.validate unless body_parameter.nil? - # Construct URL - path = "/reqopt/optional/integer/property" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless body_parameter.nil? - body_parameter = IntOptionalWrapper.serialize_object(body_parameter) - end - request_content = JSON.generate(body_parameter, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Test explicitly required integer. Please put a header 'headerParameter' => - # null and the client library should throw before the request is sent. - # - # @param header_parameter [Integer] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post_required_integer_header(header_parameter, custom_headers = nil) - fail ArgumentError, 'header_parameter is nil' if header_parameter.nil? - # Construct URL - path = "/reqopt/requied/integer/header" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["headerParameter"] = header_parameter.to_s unless header_parameter.to_s.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Test explicitly optional integer. Please put a header 'headerParameter' => - # null. - # - # @param header_parameter [Integer] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post_optional_integer_header(header_parameter = nil, custom_headers = nil) - # Construct URL - path = "/reqopt/optional/integer/header" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["headerParameter"] = header_parameter.to_s unless header_parameter.to_s.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Test explicitly required string. Please put null and the client library - # should throw before the request is sent. - # - # @param body_parameter [String] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post_required_string_parameter(body_parameter, custom_headers = nil) - fail ArgumentError, 'body_parameter is nil' if body_parameter.nil? - # Construct URL - path = "/reqopt/requied/string/parameter" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(body_parameter, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Test explicitly optional string. Please put null. - # - # @param body_parameter [String] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post_optional_string_parameter(body_parameter = nil, custom_headers = nil) - # Construct URL - path = "/reqopt/optional/string/parameter" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(body_parameter, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Test explicitly required string. Please put a valid string-wrapper with - # 'value' = null and the client library should throw before the request is - # sent. - # - # @param body_parameter [StringWrapper] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post_required_string_property(body_parameter, custom_headers = nil) - fail ArgumentError, 'body_parameter is nil' if body_parameter.nil? - body_parameter.validate unless body_parameter.nil? - # Construct URL - path = "/reqopt/requied/string/property" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless body_parameter.nil? - body_parameter = StringWrapper.serialize_object(body_parameter) - end - request_content = JSON.generate(body_parameter, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Test explicitly optional integer. Please put a valid string-wrapper with - # 'value' = null. - # - # @param body_parameter [StringOptionalWrapper] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post_optional_string_property(body_parameter = nil, custom_headers = nil) - body_parameter.validate unless body_parameter.nil? - # Construct URL - path = "/reqopt/optional/string/property" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless body_parameter.nil? - body_parameter = StringOptionalWrapper.serialize_object(body_parameter) - end - request_content = JSON.generate(body_parameter, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Test explicitly required string. Please put a header 'headerParameter' => - # null and the client library should throw before the request is sent. - # - # @param header_parameter [String] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post_required_string_header(header_parameter, custom_headers = nil) - fail ArgumentError, 'header_parameter is nil' if header_parameter.nil? - # Construct URL - path = "/reqopt/requied/string/header" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["headerParameter"] = header_parameter unless header_parameter.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Test explicitly optional string. Please put a header 'headerParameter' => - # null. - # - # @param body_parameter [String] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post_optional_string_header(body_parameter = nil, custom_headers = nil) - # Construct URL - path = "/reqopt/optional/string/header" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["bodyParameter"] = body_parameter unless body_parameter.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Test explicitly required complex object. Please put null and the client - # library should throw before the request is sent. - # - # @param body_parameter [Product] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post_required_class_parameter(body_parameter, custom_headers = nil) - fail ArgumentError, 'body_parameter is nil' if body_parameter.nil? - body_parameter.validate unless body_parameter.nil? - # Construct URL - path = "/reqopt/requied/class/parameter" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless body_parameter.nil? - body_parameter = Product.serialize_object(body_parameter) - end - request_content = JSON.generate(body_parameter, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Test explicitly optional complex object. Please put null. - # - # @param body_parameter [Product] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post_optional_class_parameter(body_parameter = nil, custom_headers = nil) - body_parameter.validate unless body_parameter.nil? - # Construct URL - path = "/reqopt/optional/class/parameter" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless body_parameter.nil? - body_parameter = Product.serialize_object(body_parameter) - end - request_content = JSON.generate(body_parameter, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Test explicitly required complex object. Please put a valid class-wrapper - # with 'value' = null and the client library should throw before the request - # is sent. - # - # @param body_parameter [ClassWrapper] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post_required_class_property(body_parameter, custom_headers = nil) - fail ArgumentError, 'body_parameter is nil' if body_parameter.nil? - body_parameter.validate unless body_parameter.nil? - # Construct URL - path = "/reqopt/requied/class/property" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless body_parameter.nil? - body_parameter = ClassWrapper.serialize_object(body_parameter) - end - request_content = JSON.generate(body_parameter, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Test explicitly optional complex object. Please put a valid class-wrapper - # with 'value' = null. - # - # @param body_parameter [ClassOptionalWrapper] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post_optional_class_property(body_parameter = nil, custom_headers = nil) - body_parameter.validate unless body_parameter.nil? - # Construct URL - path = "/reqopt/optional/class/property" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless body_parameter.nil? - body_parameter = ClassOptionalWrapper.serialize_object(body_parameter) - end - request_content = JSON.generate(body_parameter, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Test explicitly required array. Please put null and the client library - # should throw before the request is sent. - # - # @param body_parameter [Array] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post_required_array_parameter(body_parameter, custom_headers = nil) - fail ArgumentError, 'body_parameter is nil' if body_parameter.nil? - body_parameter.each{ |e| e.validate if e.respond_to?(:validate) } unless body_parameter.nil? - # Construct URL - path = "/reqopt/requied/array/parameter" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(body_parameter, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Test explicitly optional array. Please put null. - # - # @param body_parameter [Array] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post_optional_array_parameter(body_parameter = nil, custom_headers = nil) - body_parameter.each{ |e| e.validate if e.respond_to?(:validate) } unless body_parameter.nil? - # Construct URL - path = "/reqopt/optional/array/parameter" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(body_parameter, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Test explicitly required array. Please put a valid array-wrapper with - # 'value' = null and the client library should throw before the request is - # sent. - # - # @param body_parameter [ArrayWrapper] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post_required_array_property(body_parameter, custom_headers = nil) - fail ArgumentError, 'body_parameter is nil' if body_parameter.nil? - body_parameter.validate unless body_parameter.nil? - # Construct URL - path = "/reqopt/requied/array/property" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless body_parameter.nil? - body_parameter = ArrayWrapper.serialize_object(body_parameter) - end - request_content = JSON.generate(body_parameter, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Test explicitly optional array. Please put a valid array-wrapper with - # 'value' = null. - # - # @param body_parameter [ArrayOptionalWrapper] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post_optional_array_property(body_parameter = nil, custom_headers = nil) - body_parameter.validate unless body_parameter.nil? - # Construct URL - path = "/reqopt/optional/array/property" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - unless body_parameter.nil? - body_parameter = ArrayOptionalWrapper.serialize_object(body_parameter) - end - request_content = JSON.generate(body_parameter, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Test explicitly required array. Please put a header 'headerParameter' => - # null and the client library should throw before the request is sent. - # - # @param header_parameter [Array] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post_required_array_header(header_parameter, custom_headers = nil) - fail ArgumentError, 'header_parameter is nil' if header_parameter.nil? - header_parameter.each{ |e| e.validate if e.respond_to?(:validate) } unless header_parameter.nil? - # Construct URL - path = "/reqopt/requied/array/header" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["headerParameter"] = header_parameter.to_s unless header_parameter.to_s.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Test explicitly optional integer. Please put a header 'headerParameter' => - # null. - # - # @param header_parameter [Array] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def post_optional_array_header(header_parameter = nil, custom_headers = nil) - header_parameter.each{ |e| e.validate if e.respond_to?(:validate) } unless header_parameter.nil? - # Construct URL - path = "/reqopt/optional/array/header" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["headerParameter"] = header_parameter.to_s unless header_parameter.to_s.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.post do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/implicit.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/implicit.rb deleted file mode 100644 index 8c4684397..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/implicit.rb +++ /dev/null @@ -1,494 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module RequiredOptionalModule - # - # Test Infrastructure for AutoRest - # - class Implicit - include RequiredOptionalModule::Models - - # - # Creates and initializes a new instance of the Implicit class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestRequiredOptionalTestService - attr_reader :client - - # - # Test implicitly required path parameter - # - # @param path_parameter [String] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_required_path(path_parameter, custom_headers = nil) - fail ArgumentError, 'path_parameter is nil' if path_parameter.nil? - # Construct URL - path = "/reqopt/implicit/required/path/{pathParameter}" - path['{pathParameter}'] = ERB::Util.url_encode(path_parameter) if path.include?('{pathParameter}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Test implicitly optional query parameter - # - # @param query_parameter [String] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_optional_query(query_parameter = nil, custom_headers = nil) - # Construct URL - path = "/reqopt/implicit/optional/query" - url = URI.join(@client.base_url, path) - properties = { 'queryParameter' => query_parameter } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Test implicitly optional header parameter - # - # @param query_parameter [String] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_optional_header(query_parameter = nil, custom_headers = nil) - # Construct URL - path = "/reqopt/implicit/optional/header" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - # Set Headers - request_headers["queryParameter"] = query_parameter unless query_parameter.nil? - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Test implicitly optional body parameter - # - # @param body_parameter [String] - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_optional_body(body_parameter = nil, custom_headers = nil) - # Construct URL - path = "/reqopt/implicit/optional/body" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(body_parameter, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Test implicitly required path parameter - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_required_global_path(custom_headers = nil) - fail ArgumentError, '@client.required_global_path is nil' if @client.required_global_path.nil? - # Construct URL - path = "/reqopt/global/required/path/{required-global-path}" - path['{required-global-path}'] = ERB::Util.url_encode(@client.required_global_path) if path.include?('{required-global-path}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Test implicitly required query parameter - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_required_global_query(custom_headers = nil) - fail ArgumentError, '@client.required_global_query is nil' if @client.required_global_query.nil? - # Construct URL - path = "/reqopt/global/required/query" - url = URI.join(@client.base_url, path) - properties = { 'required-global-query' => @client.required_global_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - # - # Test implicitly optional query parameter - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_optional_global_query(custom_headers = nil) - # Construct URL - path = "/reqopt/global/optional/query" - url = URI.join(@client.base_url, path) - properties = { 'optional-global-query' => @client.optional_global_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code >= 200 && status_code < 300) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - unless parsed_response.nil? - parsed_response = Error.deserialize_object(parsed_response) - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/models/array_optional_wrapper.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/models/array_optional_wrapper.rb deleted file mode 100644 index 7fbbabee9..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/models/array_optional_wrapper.rb +++ /dev/null @@ -1,59 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module RequiredOptionalModule - module Models - # - # Model object. - # - class ArrayOptionalWrapper - # @return [Array] - attr_accessor :value - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - @value.each{ |e| e.validate if e.respond_to?(:validate) } unless @value.nil? - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.value - output_object['value'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [ArrayOptionalWrapper] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = ArrayOptionalWrapper.new - - deserialized_property = object['value'] - output_object.value = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/models/array_wrapper.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/models/array_wrapper.rb deleted file mode 100644 index 92954ae57..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/models/array_wrapper.rb +++ /dev/null @@ -1,60 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module RequiredOptionalModule - module Models - # - # Model object. - # - class ArrayWrapper - # @return [Array] - attr_accessor :value - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - fail MsRest::ValidationError, 'property value is nil' if @value.nil? - @value.each{ |e| e.validate if e.respond_to?(:validate) } unless @value.nil? - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.value - output_object['value'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [ArrayWrapper] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = ArrayWrapper.new - - deserialized_property = object['value'] - output_object.value = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/models/class_optional_wrapper.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/models/class_optional_wrapper.rb deleted file mode 100644 index 73fbca8f8..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/models/class_optional_wrapper.rb +++ /dev/null @@ -1,65 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module RequiredOptionalModule - module Models - # - # Model object. - # - class ClassOptionalWrapper - # @return [Product] - attr_accessor :value - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - @value.validate unless @value.nil? - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.value - unless serialized_property.nil? - serialized_property = Product.serialize_object(serialized_property) - end - output_object['value'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [ClassOptionalWrapper] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = ClassOptionalWrapper.new - - deserialized_property = object['value'] - unless deserialized_property.nil? - deserialized_property = Product.deserialize_object(deserialized_property) - end - output_object.value = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/models/class_wrapper.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/models/class_wrapper.rb deleted file mode 100644 index fec165e83..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/models/class_wrapper.rb +++ /dev/null @@ -1,66 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module RequiredOptionalModule - module Models - # - # Model object. - # - class ClassWrapper - # @return [Product] - attr_accessor :value - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - fail MsRest::ValidationError, 'property value is nil' if @value.nil? - @value.validate unless @value.nil? - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.value - unless serialized_property.nil? - serialized_property = Product.serialize_object(serialized_property) - end - output_object['value'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [ClassWrapper] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = ClassWrapper.new - - deserialized_property = object['value'] - unless deserialized_property.nil? - deserialized_property = Product.deserialize_object(deserialized_property) - end - output_object.value = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/models/error.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/models/error.rb deleted file mode 100644 index 032cffdd7..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/models/error.rb +++ /dev/null @@ -1,69 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module RequiredOptionalModule - module Models - # - # Model object. - # - class Error - # @return [Integer] - attr_accessor :status - - # @return [String] - attr_accessor :message - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.status - output_object['status'] = serialized_property unless serialized_property.nil? - - serialized_property = object.message - output_object['message'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Error] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Error.new - - deserialized_property = object['status'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.status = deserialized_property - - deserialized_property = object['message'] - output_object.message = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/models/int_optional_wrapper.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/models/int_optional_wrapper.rb deleted file mode 100644 index d2f1a2f15..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/models/int_optional_wrapper.rb +++ /dev/null @@ -1,60 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module RequiredOptionalModule - module Models - # - # Model object. - # - class IntOptionalWrapper - # @return [Integer] - attr_accessor :value - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.value - output_object['value'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [IntOptionalWrapper] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = IntOptionalWrapper.new - - deserialized_property = object['value'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.value = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/models/int_wrapper.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/models/int_wrapper.rb deleted file mode 100644 index c3dadd38c..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/models/int_wrapper.rb +++ /dev/null @@ -1,60 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module RequiredOptionalModule - module Models - # - # Model object. - # - class IntWrapper - # @return [Integer] - attr_accessor :value - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - fail MsRest::ValidationError, 'property value is nil' if @value.nil? - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.value - output_object['value'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [IntWrapper] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = IntWrapper.new - - deserialized_property = object['value'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.value = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/models/product.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/models/product.rb deleted file mode 100644 index f0a08e81c..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/models/product.rb +++ /dev/null @@ -1,69 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module RequiredOptionalModule - module Models - # - # Model object. - # - class Product - # @return [Integer] - attr_accessor :id - - # @return [String] - attr_accessor :name - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - fail MsRest::ValidationError, 'property id is nil' if @id.nil? - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.id - output_object['id'] = serialized_property unless serialized_property.nil? - - serialized_property = object.name - output_object['name'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Product] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Product.new - - deserialized_property = object['id'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.id = deserialized_property - - deserialized_property = object['name'] - output_object.name = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/models/string_optional_wrapper.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/models/string_optional_wrapper.rb deleted file mode 100644 index 1be980eca..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/models/string_optional_wrapper.rb +++ /dev/null @@ -1,59 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module RequiredOptionalModule - module Models - # - # Model object. - # - class StringOptionalWrapper - # @return [String] - attr_accessor :value - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.value - output_object['value'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [StringOptionalWrapper] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = StringOptionalWrapper.new - - deserialized_property = object['value'] - output_object.value = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/models/string_wrapper.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/models/string_wrapper.rb deleted file mode 100644 index b850b6e3d..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/required_optional/required_optional/models/string_wrapper.rb +++ /dev/null @@ -1,59 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module RequiredOptionalModule - module Models - # - # Model object. - # - class StringWrapper - # @return [String] - attr_accessor :value - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - fail MsRest::ValidationError, 'property value is nil' if @value.nil? - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.value - output_object['value'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [StringWrapper] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = StringWrapper.new - - deserialized_property = object['value'] - output_object.value = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/string/body_string.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/string/body_string.rb deleted file mode 100644 index d3c841a4f..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/string/body_string.rb +++ /dev/null @@ -1,33 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -require 'uri' -require 'cgi' -require 'date' -require 'json' -require 'base64' -require 'erb' -require 'securerandom' -require 'time' -require 'timeliness' -require 'faraday' -require 'faraday-cookie_jar' -require 'concurrent' -require 'ms_rest' - -module StringModule - autoload :String, 'body_string/string.rb' - autoload :Enum, 'body_string/enum.rb' - autoload :AutoRestSwaggerBATService, 'body_string/auto_rest_swagger_batservice.rb' - - module Models - autoload :Error, 'body_string/models/error.rb' - autoload :Colors, 'body_string/models/colors.rb' - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/string/body_string/auto_rest_swagger_batservice.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/string/body_string/auto_rest_swagger_batservice.rb deleted file mode 100644 index a50a2fe30..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/string/body_string/auto_rest_swagger_batservice.rb +++ /dev/null @@ -1,45 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module StringModule - # - # A service client - single point of access to the REST API. - # - class AutoRestSwaggerBATService < MsRest::ServiceClient - include StringModule::Models - - # @return [String] the base URI of the service. - attr_accessor :base_url - - # @return string - attr_reader :string - - # @return enum - attr_reader :enum - - # - # Creates initializes a new instance of the AutoRestSwaggerBATService class. - # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. - # @param base_url [String] the base URI of the service. - # @param options [Array] filters to be applied to the HTTP requests. - # - def initialize(credentials, base_url = nil, options = nil) - super(credentials, options) - @base_url = base_url || 'http://localhost' - - fail ArgumentError, 'credentials is nil' if credentials.nil? - fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) - @credentials = credentials - - @string = String.new(self) - @enum = Enum.new(self) - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/string/body_string/enum.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/string/body_string/enum.rb deleted file mode 100644 index 44ee3e86e..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/string/body_string/enum.rb +++ /dev/null @@ -1,162 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module StringModule - # - # Test Infrastructure for AutoRest Swagger BAT - # - class Enum - include StringModule::Models - - # - # Creates and initializes a new instance of the Enum class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestSwaggerBATService - attr_reader :client - - # - # Get enum value 'red color' from enumeration of 'red color', 'green-color', - # 'blue_color'. - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_not_expandable(custom_headers = nil) - # Construct URL - path = "/string/enum/notExpandable" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - if (!parsed_response.nil? && !parsed_response.empty?) - enum_is_valid = Colors.constants.any? { |e| Colors.const_get(e).to_s.downcase == parsed_response.downcase } - fail MsRest::DeserializationError.new('Error occured while deserializing the enum', nil, nil, nil) unless enum_is_valid - end - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Sends value 'red color' from enumeration of 'red color', 'green-color', - # 'blue_color' - # - # @param string_body [Colors] Possible values for this parameter include: 'red - # color', 'green-color', 'blue_color' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_not_expandable(string_body, custom_headers = nil) - fail ArgumentError, 'string_body is nil' if string_body.nil? - # Construct URL - path = "/string/enum/notExpandable" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(string_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/string/body_string/models/colors.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/string/body_string/models/colors.rb deleted file mode 100644 index 6ee2ce079..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/string/body_string/models/colors.rb +++ /dev/null @@ -1,21 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module StringModule - module Models - # - # Defines values for Colors - # - module Colors - Redcolor = "red color" - GreenColor = "green-color" - BlueColor = "blue_color" - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/string/body_string/models/error.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/string/body_string/models/error.rb deleted file mode 100644 index dd195cd03..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/string/body_string/models/error.rb +++ /dev/null @@ -1,69 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module StringModule - module Models - # - # Model object. - # - class Error - # @return [Integer] - attr_accessor :status - - # @return [String] - attr_accessor :message - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.status - output_object['status'] = serialized_property unless serialized_property.nil? - - serialized_property = object.message - output_object['message'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Error] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Error.new - - deserialized_property = object['status'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.status = deserialized_property - - deserialized_property = object['message'] - output_object.message = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/string/body_string/string.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/string/body_string/string.rb deleted file mode 100644 index a7ea51e67..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/string/body_string/string.rb +++ /dev/null @@ -1,604 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module StringModule - # - # Test Infrastructure for AutoRest Swagger BAT - # - class String - include StringModule::Models - - # - # Creates and initializes a new instance of the String class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestSwaggerBATService - attr_reader :client - - # - # Get null string value value - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_null(custom_headers = nil) - # Construct URL - path = "/string/null" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Set string value null - # - # @param string_body Possible values for this parameter include: '' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_null(string_body = nil, custom_headers = nil) - # Construct URL - path = "/string/null" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(string_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get empty string value value '' - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_empty(custom_headers = nil) - # Construct URL - path = "/string/empty" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Set string value empty '' - # - # @param string_body Possible values for this parameter include: '' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_empty(string_body, custom_headers = nil) - fail ArgumentError, 'string_body is nil' if string_body.nil? - # Construct URL - path = "/string/empty" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(string_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get mbcs string value - # '啊齄丂狛狜隣郎隣兀﨩ˊ▇█〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€ ' - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_mbcs(custom_headers = nil) - # Construct URL - path = "/string/mbcs" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Set string value mbcs - # '啊齄丂狛狜隣郎隣兀﨩ˊ▇█〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€ ' - # - # @param string_body Possible values for this parameter include: - # '啊齄丂狛狜隣郎隣兀﨩ˊ▇█〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€ ' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_mbcs(string_body, custom_headers = nil) - fail ArgumentError, 'string_body is nil' if string_body.nil? - # Construct URL - path = "/string/mbcs" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(string_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get string value with leading and trailing whitespace - # 'Now is the time for all good men to come to the aid of - # their country' - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_whitespace(custom_headers = nil) - # Construct URL - path = "/string/whitespace" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - # - # Set String value with leading and trailing whitespace - # 'Now is the time for all good men to come to the aid of - # their country' - # - # @param string_body Possible values for this parameter include: ' Now is - # the time for all good men to come to the aid of their country ' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def put_whitespace(string_body, custom_headers = nil) - fail ArgumentError, 'string_body is nil' if string_body.nil? - # Construct URL - path = "/string/whitespace" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Serialize Request - request_headers['Content-Type'] = 'application/json; charset=utf-8' - request_content = JSON.generate(string_body, quirks_mode: true) - - # Send Request - promise = Concurrent::Promise.new do - connection.put do |request| - request.headers = request_headers - request.body = request_content - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get String value when no string value is sent in response payload - # - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_not_provided(custom_headers = nil) - # Construct URL - path = "/string/notProvided" - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - # Deserialize Response - if status_code == 200 - begin - parsed_response = JSON.load(response_content) unless response_content.to_s.empty? - result.body = parsed_response - rescue Exception => e - fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content) - end - end - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url/url.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url/url.rb deleted file mode 100644 index 83af1c6cd..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url/url.rb +++ /dev/null @@ -1,34 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -require 'uri' -require 'cgi' -require 'date' -require 'json' -require 'base64' -require 'erb' -require 'securerandom' -require 'time' -require 'timeliness' -require 'faraday' -require 'faraday-cookie_jar' -require 'concurrent' -require 'ms_rest' - -module UrlModule - autoload :Paths, 'url/paths.rb' - autoload :Queries, 'url/queries.rb' - autoload :PathItems, 'url/path_items.rb' - autoload :AutoRestUrlTestService, 'url/auto_rest_url_test_service.rb' - - module Models - autoload :Error, 'url/models/error.rb' - autoload :UriColor, 'url/models/uri_color.rb' - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url/url/auto_rest_url_test_service.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url/url/auto_rest_url_test_service.rb deleted file mode 100644 index 039ca1b09..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url/url/auto_rest_url_test_service.rb +++ /dev/null @@ -1,56 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module UrlModule - # - # A service client - single point of access to the REST API. - # - class AutoRestUrlTestService < MsRest::ServiceClient - include UrlModule::Models - - # @return [String] the base URI of the service. - attr_accessor :base_url - - # @return [String] A string value 'globalItemStringPath' that appears in - # the path - attr_accessor :global_string_path - - # @return [String] should contain value null - attr_accessor :global_string_query - - # @return paths - attr_reader :paths - - # @return queries - attr_reader :queries - - # @return path_items - attr_reader :path_items - - # - # Creates initializes a new instance of the AutoRestUrlTestService class. - # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. - # @param base_url [String] the base URI of the service. - # @param options [Array] filters to be applied to the HTTP requests. - # - def initialize(credentials, base_url = nil, options = nil) - super(credentials, options) - @base_url = base_url || 'http://localhost' - - fail ArgumentError, 'credentials is nil' if credentials.nil? - fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) - @credentials = credentials - - @paths = Paths.new(self) - @queries = Queries.new(self) - @path_items = PathItems.new(self) - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url/url/models/error.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url/url/models/error.rb deleted file mode 100644 index f1453515c..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url/url/models/error.rb +++ /dev/null @@ -1,69 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module UrlModule - module Models - # - # Model object. - # - class Error - # @return [Integer] - attr_accessor :status - - # @return [String] - attr_accessor :message - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.status - output_object['status'] = serialized_property unless serialized_property.nil? - - serialized_property = object.message - output_object['message'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Error] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Error.new - - deserialized_property = object['status'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.status = deserialized_property - - deserialized_property = object['message'] - output_object.message = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url/url/models/uri_color.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url/url/models/uri_color.rb deleted file mode 100644 index 1d155a31d..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url/url/models/uri_color.rb +++ /dev/null @@ -1,21 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module UrlModule - module Models - # - # Defines values for UriColor - # - module UriColor - Redcolor = "red color" - Greencolor = "green color" - Bluecolor = "blue color" - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url/url/path_items.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url/url/path_items.rb deleted file mode 100644 index f0d9cdc6a..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url/url/path_items.rb +++ /dev/null @@ -1,345 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module UrlModule - # - # Test Infrastructure for AutoRest - # - class PathItems - include UrlModule::Models - - # - # Creates and initializes a new instance of the PathItems class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestUrlTestService - attr_reader :client - - # - # send globalStringPath='globalStringPath', - # pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', - # globalStringQuery='globalStringQuery', - # pathItemStringQuery='pathItemStringQuery', - # localStringQuery='localStringQuery' - # - # @param local_string_path [String] should contain value 'localStringPath' - # @param path_item_string_path [String] A string value 'pathItemStringPath' - # that appears in the path - # @param local_string_query [String] should contain value 'localStringQuery' - # @param path_item_string_query [String] A string value 'pathItemStringQuery' - # that appears as a query parameter - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_all_with_values(local_string_path, path_item_string_path, local_string_query = nil, path_item_string_query = nil, custom_headers = nil) - fail ArgumentError, 'local_string_path is nil' if local_string_path.nil? - fail ArgumentError, 'path_item_string_path is nil' if path_item_string_path.nil? - fail ArgumentError, '@client.global_string_path is nil' if @client.global_string_path.nil? - # Construct URL - path = "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/pathItemStringQuery/localStringQuery" - path['{localStringPath}'] = ERB::Util.url_encode(local_string_path) if path.include?('{localStringPath}') - path['{pathItemStringPath}'] = ERB::Util.url_encode(path_item_string_path) if path.include?('{pathItemStringPath}') - path['{globalStringPath}'] = ERB::Util.url_encode(@client.global_string_path) if path.include?('{globalStringPath}') - url = URI.join(@client.base_url, path) - properties = { 'localStringQuery' => local_string_query, 'pathItemStringQuery' => path_item_string_query, 'globalStringQuery' => @client.global_string_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # send globalStringPath='globalStringPath', - # pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', - # globalStringQuery=null, pathItemStringQuery='pathItemStringQuery', - # localStringQuery='localStringQuery' - # - # @param local_string_path [String] should contain value 'localStringPath' - # @param path_item_string_path [String] A string value 'pathItemStringPath' - # that appears in the path - # @param local_string_query [String] should contain value 'localStringQuery' - # @param path_item_string_query [String] A string value 'pathItemStringQuery' - # that appears as a query parameter - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_global_query_null(local_string_path, path_item_string_path, local_string_query = nil, path_item_string_query = nil, custom_headers = nil) - fail ArgumentError, 'local_string_path is nil' if local_string_path.nil? - fail ArgumentError, 'path_item_string_path is nil' if path_item_string_path.nil? - fail ArgumentError, '@client.global_string_path is nil' if @client.global_string_path.nil? - # Construct URL - path = "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/localStringQuery" - path['{localStringPath}'] = ERB::Util.url_encode(local_string_path) if path.include?('{localStringPath}') - path['{pathItemStringPath}'] = ERB::Util.url_encode(path_item_string_path) if path.include?('{pathItemStringPath}') - path['{globalStringPath}'] = ERB::Util.url_encode(@client.global_string_path) if path.include?('{globalStringPath}') - url = URI.join(@client.base_url, path) - properties = { 'localStringQuery' => local_string_query, 'pathItemStringQuery' => path_item_string_query, 'globalStringQuery' => @client.global_string_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # send globalStringPath=globalStringPath, - # pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', - # globalStringQuery=null, pathItemStringQuery='pathItemStringQuery', - # localStringQuery=null - # - # @param local_string_path [String] should contain value 'localStringPath' - # @param path_item_string_path [String] A string value 'pathItemStringPath' - # that appears in the path - # @param local_string_query [String] should contain null value - # @param path_item_string_query [String] A string value 'pathItemStringQuery' - # that appears as a query parameter - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_global_and_local_query_null(local_string_path, path_item_string_path, local_string_query = nil, path_item_string_query = nil, custom_headers = nil) - fail ArgumentError, 'local_string_path is nil' if local_string_path.nil? - fail ArgumentError, 'path_item_string_path is nil' if path_item_string_path.nil? - fail ArgumentError, '@client.global_string_path is nil' if @client.global_string_path.nil? - # Construct URL - path = "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/null" - path['{localStringPath}'] = ERB::Util.url_encode(local_string_path) if path.include?('{localStringPath}') - path['{pathItemStringPath}'] = ERB::Util.url_encode(path_item_string_path) if path.include?('{pathItemStringPath}') - path['{globalStringPath}'] = ERB::Util.url_encode(@client.global_string_path) if path.include?('{globalStringPath}') - url = URI.join(@client.base_url, path) - properties = { 'localStringQuery' => local_string_query, 'pathItemStringQuery' => path_item_string_query, 'globalStringQuery' => @client.global_string_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # send globalStringPath='globalStringPath', - # pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', - # globalStringQuery='globalStringQuery', pathItemStringQuery=null, - # localStringQuery=null - # - # @param local_string_path [String] should contain value 'localStringPath' - # @param path_item_string_path [String] A string value 'pathItemStringPath' - # that appears in the path - # @param local_string_query [String] should contain value null - # @param path_item_string_query [String] should contain value null - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_local_path_item_query_null(local_string_path, path_item_string_path, local_string_query = nil, path_item_string_query = nil, custom_headers = nil) - fail ArgumentError, 'local_string_path is nil' if local_string_path.nil? - fail ArgumentError, 'path_item_string_path is nil' if path_item_string_path.nil? - fail ArgumentError, '@client.global_string_path is nil' if @client.global_string_path.nil? - # Construct URL - path = "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/null/null" - path['{localStringPath}'] = ERB::Util.url_encode(local_string_path) if path.include?('{localStringPath}') - path['{pathItemStringPath}'] = ERB::Util.url_encode(path_item_string_path) if path.include?('{pathItemStringPath}') - path['{globalStringPath}'] = ERB::Util.url_encode(@client.global_string_path) if path.include?('{globalStringPath}') - url = URI.join(@client.base_url, path) - properties = { 'localStringQuery' => local_string_query, 'pathItemStringQuery' => path_item_string_query, 'globalStringQuery' => @client.global_string_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url/url/paths.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url/url/paths.rb deleted file mode 100644 index d09e76559..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url/url/paths.rb +++ /dev/null @@ -1,1371 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module UrlModule - # - # Test Infrastructure for AutoRest - # - class Paths - include UrlModule::Models - - # - # Creates and initializes a new instance of the Paths class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestUrlTestService - attr_reader :client - - # - # Get true Boolean value on path - # - # @param bool_path [Boolean] true boolean value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_boolean_true(bool_path, custom_headers = nil) - fail ArgumentError, 'bool_path is nil' if bool_path.nil? - # Construct URL - path = "/paths/bool/true/{boolPath}" - path['{boolPath}'] = ERB::Util.url_encode(bool_path.to_s) if path.include?('{boolPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get false Boolean value on path - # - # @param bool_path [Boolean] false boolean value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_boolean_false(bool_path, custom_headers = nil) - fail ArgumentError, 'bool_path is nil' if bool_path.nil? - # Construct URL - path = "/paths/bool/false/{boolPath}" - path['{boolPath}'] = ERB::Util.url_encode(bool_path.to_s) if path.include?('{boolPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '1000000' integer value - # - # @param int_path [Integer] '1000000' integer value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_int_one_million(int_path, custom_headers = nil) - fail ArgumentError, 'int_path is nil' if int_path.nil? - # Construct URL - path = "/paths/int/1000000/{intPath}" - path['{intPath}'] = ERB::Util.url_encode(int_path.to_s) if path.include?('{intPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '-1000000' integer value - # - # @param int_path [Integer] '-1000000' integer value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_int_negative_one_million(int_path, custom_headers = nil) - fail ArgumentError, 'int_path is nil' if int_path.nil? - # Construct URL - path = "/paths/int/-1000000/{intPath}" - path['{intPath}'] = ERB::Util.url_encode(int_path.to_s) if path.include?('{intPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '10000000000' 64 bit integer value - # - # @param long_path [Integer] '10000000000' 64 bit integer value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_ten_billion(long_path, custom_headers = nil) - fail ArgumentError, 'long_path is nil' if long_path.nil? - # Construct URL - path = "/paths/long/10000000000/{longPath}" - path['{longPath}'] = ERB::Util.url_encode(long_path.to_s) if path.include?('{longPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '-10000000000' 64 bit integer value - # - # @param long_path [Integer] '-10000000000' 64 bit integer value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_negative_ten_billion(long_path, custom_headers = nil) - fail ArgumentError, 'long_path is nil' if long_path.nil? - # Construct URL - path = "/paths/long/-10000000000/{longPath}" - path['{longPath}'] = ERB::Util.url_encode(long_path.to_s) if path.include?('{longPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '1.034E+20' numeric value - # - # @param float_path [Float] '1.034E+20'numeric value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def float_scientific_positive(float_path, custom_headers = nil) - fail ArgumentError, 'float_path is nil' if float_path.nil? - # Construct URL - path = "/paths/float/1.034E+20/{floatPath}" - path['{floatPath}'] = ERB::Util.url_encode(float_path.to_s) if path.include?('{floatPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '-1.034E-20' numeric value - # - # @param float_path [Float] '-1.034E-20'numeric value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def float_scientific_negative(float_path, custom_headers = nil) - fail ArgumentError, 'float_path is nil' if float_path.nil? - # Construct URL - path = "/paths/float/-1.034E-20/{floatPath}" - path['{floatPath}'] = ERB::Util.url_encode(float_path.to_s) if path.include?('{floatPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '9999999.999' numeric value - # - # @param double_path [Float] '9999999.999'numeric value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def double_decimal_positive(double_path, custom_headers = nil) - fail ArgumentError, 'double_path is nil' if double_path.nil? - # Construct URL - path = "/paths/double/9999999.999/{doublePath}" - path['{doublePath}'] = ERB::Util.url_encode(double_path.to_s) if path.include?('{doublePath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '-9999999.999' numeric value - # - # @param double_path [Float] '-9999999.999'numeric value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def double_decimal_negative(double_path, custom_headers = nil) - fail ArgumentError, 'double_path is nil' if double_path.nil? - # Construct URL - path = "/paths/double/-9999999.999/{doublePath}" - path['{doublePath}'] = ERB::Util.url_encode(double_path.to_s) if path.include?('{doublePath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '啊齄丂狛狜隣郎隣兀﨩' multi-byte string value - # - # @param string_path '啊齄丂狛狜隣郎隣兀﨩'multi-byte string value. Possible values for - # this parameter include: '啊齄丂狛狜隣郎隣兀﨩' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def string_unicode(string_path, custom_headers = nil) - fail ArgumentError, 'string_path is nil' if string_path.nil? - # Construct URL - path = "/paths/string/unicode/{stringPath}" - path['{stringPath}'] = ERB::Util.url_encode(string_path.to_s) if path.include?('{stringPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get 'begin!*'();:@ &=+$,/?#[]end - # - # @param string_path 'begin!*'();:@ &=+$,/?#[]end' url encoded string value. - # Possible values for this parameter include: 'begin!*'();:@ &=+$,/?#[]end' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def string_url_encoded(string_path, custom_headers = nil) - fail ArgumentError, 'string_path is nil' if string_path.nil? - # Construct URL - path = "/paths/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend/{stringPath}" - path['{stringPath}'] = ERB::Util.url_encode(string_path.to_s) if path.include?('{stringPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '' - # - # @param string_path '' string value. Possible values for this parameter - # include: '' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def string_empty(string_path, custom_headers = nil) - fail ArgumentError, 'string_path is nil' if string_path.nil? - # Construct URL - path = "/paths/string/empty/{stringPath}" - path['{stringPath}'] = ERB::Util.url_encode(string_path.to_s) if path.include?('{stringPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null (should throw) - # - # @param string_path [String] null string value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def string_null(string_path, custom_headers = nil) - fail ArgumentError, 'string_path is nil' if string_path.nil? - # Construct URL - path = "/paths/string/null/{stringPath}" - path['{stringPath}'] = ERB::Util.url_encode(string_path) if path.include?('{stringPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 400) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get using uri with 'green color' in path parameter - # - # @param enum_path [UriColor] send the value green. Possible values for this - # parameter include: 'red color', 'green color', 'blue color' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def enum_valid(enum_path, custom_headers = nil) - fail ArgumentError, 'enum_path is nil' if enum_path.nil? - # Construct URL - path = "/paths/enum/green%20color/{enumPath}" - path['{enumPath}'] = ERB::Util.url_encode(enum_path.to_s) if path.include?('{enumPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null (should throw on the client before the request is sent on wire) - # - # @param enum_path [UriColor] send null should throw. Possible values for this - # parameter include: 'red color', 'green color', 'blue color' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def enum_null(enum_path, custom_headers = nil) - fail ArgumentError, 'enum_path is nil' if enum_path.nil? - # Construct URL - path = "/paths/string/null/{enumPath}" - path['{enumPath}'] = ERB::Util.url_encode(enum_path.to_s) if path.include?('{enumPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 400) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array - # - # @param byte_path [Array] '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 - # encoded byte array - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def byte_multi_byte(byte_path, custom_headers = nil) - fail ArgumentError, 'byte_path is nil' if byte_path.nil? - # Construct URL - path = "/paths/byte/multibyte/{bytePath}" - path['{bytePath}'] = ERB::Util.url_encode(byte_path.to_s) if path.include?('{bytePath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '' as byte array - # - # @param byte_path [Array] '' as byte array - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def byte_empty(byte_path, custom_headers = nil) - fail ArgumentError, 'byte_path is nil' if byte_path.nil? - # Construct URL - path = "/paths/byte/empty/{bytePath}" - path['{bytePath}'] = ERB::Util.url_encode(byte_path.to_s) if path.include?('{bytePath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null as byte array (should throw) - # - # @param byte_path [Array] null as byte array (should throw) - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def byte_null(byte_path, custom_headers = nil) - fail ArgumentError, 'byte_path is nil' if byte_path.nil? - # Construct URL - path = "/paths/byte/null/{bytePath}" - path['{bytePath}'] = ERB::Util.url_encode(byte_path.to_s) if path.include?('{bytePath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 400) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '2012-01-01' as date - # - # @param date_path [Date] '2012-01-01' as date - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def date_valid(date_path, custom_headers = nil) - fail ArgumentError, 'date_path is nil' if date_path.nil? - # Construct URL - path = "/paths/date/2012-01-01/{datePath}" - path['{datePath}'] = ERB::Util.url_encode(date_path.to_s) if path.include?('{datePath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null as date - this should throw or be unusable on the client side, - # depending on date representation - # - # @param date_path [Date] null as date (should throw) - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def date_null(date_path, custom_headers = nil) - fail ArgumentError, 'date_path is nil' if date_path.nil? - # Construct URL - path = "/paths/date/null/{datePath}" - path['{datePath}'] = ERB::Util.url_encode(date_path.to_s) if path.include?('{datePath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 400) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '2012-01-01T01:01:01Z' as date-time - # - # @param date_time_path [DateTime] '2012-01-01T01:01:01Z' as date-time - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def date_time_valid(date_time_path, custom_headers = nil) - fail ArgumentError, 'date_time_path is nil' if date_time_path.nil? - # Construct URL - path = "/paths/datetime/2012-01-01T01%3A01%3A01Z/{dateTimePath}" - path['{dateTimePath}'] = ERB::Util.url_encode(date_time_path.to_s) if path.include?('{dateTimePath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null as date-time, should be disallowed or throw depending on - # representation of date-time - # - # @param date_time_path [DateTime] null as date-time - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def date_time_null(date_time_path, custom_headers = nil) - fail ArgumentError, 'date_time_path is nil' if date_time_path.nil? - # Construct URL - path = "/paths/datetime/null/{dateTimePath}" - path['{dateTimePath}'] = ERB::Util.url_encode(date_time_path.to_s) if path.include?('{dateTimePath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 400) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url/url/queries.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url/url/queries.rb deleted file mode 100644 index 168830010..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url/url/queries.rb +++ /dev/null @@ -1,2262 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module UrlModule - # - # Test Infrastructure for AutoRest - # - class Queries - include UrlModule::Models - - # - # Creates and initializes a new instance of the Queries class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestUrlTestService - attr_reader :client - - # - # Get true Boolean value on path - # - # @param bool_query [Boolean] true boolean value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_boolean_true(bool_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/bool/true" - url = URI.join(@client.base_url, path) - properties = { 'boolQuery' => bool_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get false Boolean value on path - # - # @param bool_query [Boolean] false boolean value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_boolean_false(bool_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/bool/false" - url = URI.join(@client.base_url, path) - properties = { 'boolQuery' => bool_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null Boolean value on query (query string should be absent) - # - # @param bool_query [Boolean] null boolean value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_boolean_null(bool_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/bool/null" - url = URI.join(@client.base_url, path) - properties = { 'boolQuery' => bool_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '1000000' integer value - # - # @param int_query [Integer] '1000000' integer value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_int_one_million(int_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/int/1000000" - url = URI.join(@client.base_url, path) - properties = { 'intQuery' => int_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '-1000000' integer value - # - # @param int_query [Integer] '-1000000' integer value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_int_negative_one_million(int_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/int/-1000000" - url = URI.join(@client.base_url, path) - properties = { 'intQuery' => int_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null integer value (no query parameter) - # - # @param int_query [Integer] null integer value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_int_null(int_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/int/null" - url = URI.join(@client.base_url, path) - properties = { 'intQuery' => int_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '10000000000' 64 bit integer value - # - # @param long_query [Integer] '10000000000' 64 bit integer value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_ten_billion(long_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/long/10000000000" - url = URI.join(@client.base_url, path) - properties = { 'longQuery' => long_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '-10000000000' 64 bit integer value - # - # @param long_query [Integer] '-10000000000' 64 bit integer value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_negative_ten_billion(long_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/long/-10000000000" - url = URI.join(@client.base_url, path) - properties = { 'longQuery' => long_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get 'null 64 bit integer value (no query param in uri) - # - # @param long_query [Integer] null 64 bit integer value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_long_null(long_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/long/null" - url = URI.join(@client.base_url, path) - properties = { 'longQuery' => long_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '1.034E+20' numeric value - # - # @param float_query [Float] '1.034E+20'numeric value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def float_scientific_positive(float_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/float/1.034E+20" - url = URI.join(@client.base_url, path) - properties = { 'floatQuery' => float_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '-1.034E-20' numeric value - # - # @param float_query [Float] '-1.034E-20'numeric value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def float_scientific_negative(float_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/float/-1.034E-20" - url = URI.join(@client.base_url, path) - properties = { 'floatQuery' => float_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null numeric value (no query parameter) - # - # @param float_query [Float] null numeric value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def float_null(float_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/float/null" - url = URI.join(@client.base_url, path) - properties = { 'floatQuery' => float_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '9999999.999' numeric value - # - # @param double_query [Float] '9999999.999'numeric value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def double_decimal_positive(double_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/double/9999999.999" - url = URI.join(@client.base_url, path) - properties = { 'doubleQuery' => double_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '-9999999.999' numeric value - # - # @param double_query [Float] '-9999999.999'numeric value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def double_decimal_negative(double_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/double/-9999999.999" - url = URI.join(@client.base_url, path) - properties = { 'doubleQuery' => double_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null numeric value (no query parameter) - # - # @param double_query [Float] null numeric value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def double_null(double_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/double/null" - url = URI.join(@client.base_url, path) - properties = { 'doubleQuery' => double_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '啊齄丂狛狜隣郎隣兀﨩' multi-byte string value - # - # @param string_query '啊齄丂狛狜隣郎隣兀﨩'multi-byte string value. Possible values for - # this parameter include: '啊齄丂狛狜隣郎隣兀﨩' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def string_unicode(string_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/string/unicode/" - url = URI.join(@client.base_url, path) - properties = { 'stringQuery' => string_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get 'begin!*'();:@ &=+$,/?#[]end - # - # @param string_query 'begin!*'();:@ &=+$,/?#[]end' url encoded string value. - # Possible values for this parameter include: 'begin!*'();:@ &=+$,/?#[]end' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def string_url_encoded(string_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend" - url = URI.join(@client.base_url, path) - properties = { 'stringQuery' => string_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '' - # - # @param string_query '' string value. Possible values for this parameter - # include: '' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def string_empty(string_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/string/empty" - url = URI.join(@client.base_url, path) - properties = { 'stringQuery' => string_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null (no query parameter in url) - # - # @param string_query [String] null string value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def string_null(string_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/string/null" - url = URI.join(@client.base_url, path) - properties = { 'stringQuery' => string_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get using uri with query parameter 'green color' - # - # @param enum_query [UriColor] 'green color' enum value. Possible values for - # this parameter include: 'red color', 'green color', 'blue color' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def enum_valid(enum_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/enum/green%20color" - url = URI.join(@client.base_url, path) - properties = { 'enumQuery' => enum_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null (no query parameter in url) - # - # @param enum_query [UriColor] null string value. Possible values for this - # parameter include: 'red color', 'green color', 'blue color' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def enum_null(enum_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/enum/null" - url = URI.join(@client.base_url, path) - properties = { 'enumQuery' => enum_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array - # - # @param byte_query [Array] '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 - # encoded byte array - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def byte_multi_byte(byte_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/byte/multibyte" - url = URI.join(@client.base_url, path) - properties = { 'byteQuery' => byte_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '' as byte array - # - # @param byte_query [Array] '' as byte array - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def byte_empty(byte_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/byte/empty" - url = URI.join(@client.base_url, path) - properties = { 'byteQuery' => byte_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null as byte array (no query parameters in uri) - # - # @param byte_query [Array] null as byte array (no query parameters - # in uri) - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def byte_null(byte_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/byte/null" - url = URI.join(@client.base_url, path) - properties = { 'byteQuery' => byte_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '2012-01-01' as date - # - # @param date_query [Date] '2012-01-01' as date - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def date_valid(date_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/date/2012-01-01" - url = URI.join(@client.base_url, path) - properties = { 'dateQuery' => date_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null as date - this should result in no query parameters in uri - # - # @param date_query [Date] null as date (no query parameters in uri) - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def date_null(date_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/date/null" - url = URI.join(@client.base_url, path) - properties = { 'dateQuery' => date_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '2012-01-01T01:01:01Z' as date-time - # - # @param date_time_query [DateTime] '2012-01-01T01:01:01Z' as date-time - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def date_time_valid(date_time_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/datetime/2012-01-01T01%3A01%3A01Z" - url = URI.join(@client.base_url, path) - properties = { 'dateTimeQuery' => date_time_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null as date-time, should result in no query parameters in uri - # - # @param date_time_query [DateTime] null as date-time (no query parameters) - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def date_time_null(date_time_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/datetime/null" - url = URI.join(@client.base_url, path) - properties = { 'dateTimeQuery' => date_time_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, - # ''] using the csv-array format - # - # @param array_query [Array] an array of string ['ArrayQuery1', - # 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the csv-array format - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def array_string_csv_valid(array_query = nil, custom_headers = nil) - array_query.each{ |e| e.validate if e.respond_to?(:validate) } unless array_query.nil? - # Construct URL - path = "/queries/array/csv/string/valid" - url = URI.join(@client.base_url, path) - properties = { 'arrayQuery' => array_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get a null array of string using the csv-array format - # - # @param array_query [Array] a null array of string using the - # csv-array format - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def array_string_csv_null(array_query = nil, custom_headers = nil) - array_query.each{ |e| e.validate if e.respond_to?(:validate) } unless array_query.nil? - # Construct URL - path = "/queries/array/csv/string/null" - url = URI.join(@client.base_url, path) - properties = { 'arrayQuery' => array_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get an empty array [] of string using the csv-array format - # - # @param array_query [Array] an empty array [] of string using the - # csv-array format - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def array_string_csv_empty(array_query = nil, custom_headers = nil) - array_query.each{ |e| e.validate if e.respond_to?(:validate) } unless array_query.nil? - # Construct URL - path = "/queries/array/csv/string/empty" - url = URI.join(@client.base_url, path) - properties = { 'arrayQuery' => array_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, - # ''] using the ssv-array format - # - # @param array_query [Array] an array of string ['ArrayQuery1', - # 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the ssv-array format - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def array_string_ssv_valid(array_query = nil, custom_headers = nil) - array_query.each{ |e| e.validate if e.respond_to?(:validate) } unless array_query.nil? - # Construct URL - path = "/queries/array/ssv/string/valid" - url = URI.join(@client.base_url, path) - properties = { 'arrayQuery' => array_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, - # ''] using the tsv-array format - # - # @param array_query [Array] an array of string ['ArrayQuery1', - # 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the tsv-array format - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def array_string_tsv_valid(array_query = nil, custom_headers = nil) - array_query.each{ |e| e.validate if e.respond_to?(:validate) } unless array_query.nil? - # Construct URL - path = "/queries/array/tsv/string/valid" - url = URI.join(@client.base_url, path) - properties = { 'arrayQuery' => array_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, - # ''] using the pipes-array format - # - # @param array_query [Array] an array of string ['ArrayQuery1', - # 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the pipes-array format - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def array_string_pipes_valid(array_query = nil, custom_headers = nil) - array_query.each{ |e| e.validate if e.respond_to?(:validate) } unless array_query.nil? - # Construct URL - path = "/queries/array/pipes/string/valid" - url = URI.join(@client.base_url, path) - properties = { 'arrayQuery' => array_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_items/url.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_items/url.rb deleted file mode 100644 index 83af1c6cd..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_items/url.rb +++ /dev/null @@ -1,34 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -require 'uri' -require 'cgi' -require 'date' -require 'json' -require 'base64' -require 'erb' -require 'securerandom' -require 'time' -require 'timeliness' -require 'faraday' -require 'faraday-cookie_jar' -require 'concurrent' -require 'ms_rest' - -module UrlModule - autoload :Paths, 'url/paths.rb' - autoload :Queries, 'url/queries.rb' - autoload :PathItems, 'url/path_items.rb' - autoload :AutoRestUrlTestService, 'url/auto_rest_url_test_service.rb' - - module Models - autoload :Error, 'url/models/error.rb' - autoload :UriColor, 'url/models/uri_color.rb' - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_items/url/auto_rest_url_test_service.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_items/url/auto_rest_url_test_service.rb deleted file mode 100644 index 039ca1b09..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_items/url/auto_rest_url_test_service.rb +++ /dev/null @@ -1,56 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module UrlModule - # - # A service client - single point of access to the REST API. - # - class AutoRestUrlTestService < MsRest::ServiceClient - include UrlModule::Models - - # @return [String] the base URI of the service. - attr_accessor :base_url - - # @return [String] A string value 'globalItemStringPath' that appears in - # the path - attr_accessor :global_string_path - - # @return [String] should contain value null - attr_accessor :global_string_query - - # @return paths - attr_reader :paths - - # @return queries - attr_reader :queries - - # @return path_items - attr_reader :path_items - - # - # Creates initializes a new instance of the AutoRestUrlTestService class. - # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. - # @param base_url [String] the base URI of the service. - # @param options [Array] filters to be applied to the HTTP requests. - # - def initialize(credentials, base_url = nil, options = nil) - super(credentials, options) - @base_url = base_url || 'http://localhost' - - fail ArgumentError, 'credentials is nil' if credentials.nil? - fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) - @credentials = credentials - - @paths = Paths.new(self) - @queries = Queries.new(self) - @path_items = PathItems.new(self) - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_items/url/models/error.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_items/url/models/error.rb deleted file mode 100644 index f1453515c..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_items/url/models/error.rb +++ /dev/null @@ -1,69 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module UrlModule - module Models - # - # Model object. - # - class Error - # @return [Integer] - attr_accessor :status - - # @return [String] - attr_accessor :message - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.status - output_object['status'] = serialized_property unless serialized_property.nil? - - serialized_property = object.message - output_object['message'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Error] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Error.new - - deserialized_property = object['status'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.status = deserialized_property - - deserialized_property = object['message'] - output_object.message = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_items/url/models/uri_color.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_items/url/models/uri_color.rb deleted file mode 100644 index 1d155a31d..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_items/url/models/uri_color.rb +++ /dev/null @@ -1,21 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module UrlModule - module Models - # - # Defines values for UriColor - # - module UriColor - Redcolor = "red color" - Greencolor = "green color" - Bluecolor = "blue color" - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_items/url/path_items.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_items/url/path_items.rb deleted file mode 100644 index f0d9cdc6a..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_items/url/path_items.rb +++ /dev/null @@ -1,345 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module UrlModule - # - # Test Infrastructure for AutoRest - # - class PathItems - include UrlModule::Models - - # - # Creates and initializes a new instance of the PathItems class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestUrlTestService - attr_reader :client - - # - # send globalStringPath='globalStringPath', - # pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', - # globalStringQuery='globalStringQuery', - # pathItemStringQuery='pathItemStringQuery', - # localStringQuery='localStringQuery' - # - # @param local_string_path [String] should contain value 'localStringPath' - # @param path_item_string_path [String] A string value 'pathItemStringPath' - # that appears in the path - # @param local_string_query [String] should contain value 'localStringQuery' - # @param path_item_string_query [String] A string value 'pathItemStringQuery' - # that appears as a query parameter - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_all_with_values(local_string_path, path_item_string_path, local_string_query = nil, path_item_string_query = nil, custom_headers = nil) - fail ArgumentError, 'local_string_path is nil' if local_string_path.nil? - fail ArgumentError, 'path_item_string_path is nil' if path_item_string_path.nil? - fail ArgumentError, '@client.global_string_path is nil' if @client.global_string_path.nil? - # Construct URL - path = "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/pathItemStringQuery/localStringQuery" - path['{localStringPath}'] = ERB::Util.url_encode(local_string_path) if path.include?('{localStringPath}') - path['{pathItemStringPath}'] = ERB::Util.url_encode(path_item_string_path) if path.include?('{pathItemStringPath}') - path['{globalStringPath}'] = ERB::Util.url_encode(@client.global_string_path) if path.include?('{globalStringPath}') - url = URI.join(@client.base_url, path) - properties = { 'localStringQuery' => local_string_query, 'pathItemStringQuery' => path_item_string_query, 'globalStringQuery' => @client.global_string_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # send globalStringPath='globalStringPath', - # pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', - # globalStringQuery=null, pathItemStringQuery='pathItemStringQuery', - # localStringQuery='localStringQuery' - # - # @param local_string_path [String] should contain value 'localStringPath' - # @param path_item_string_path [String] A string value 'pathItemStringPath' - # that appears in the path - # @param local_string_query [String] should contain value 'localStringQuery' - # @param path_item_string_query [String] A string value 'pathItemStringQuery' - # that appears as a query parameter - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_global_query_null(local_string_path, path_item_string_path, local_string_query = nil, path_item_string_query = nil, custom_headers = nil) - fail ArgumentError, 'local_string_path is nil' if local_string_path.nil? - fail ArgumentError, 'path_item_string_path is nil' if path_item_string_path.nil? - fail ArgumentError, '@client.global_string_path is nil' if @client.global_string_path.nil? - # Construct URL - path = "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/localStringQuery" - path['{localStringPath}'] = ERB::Util.url_encode(local_string_path) if path.include?('{localStringPath}') - path['{pathItemStringPath}'] = ERB::Util.url_encode(path_item_string_path) if path.include?('{pathItemStringPath}') - path['{globalStringPath}'] = ERB::Util.url_encode(@client.global_string_path) if path.include?('{globalStringPath}') - url = URI.join(@client.base_url, path) - properties = { 'localStringQuery' => local_string_query, 'pathItemStringQuery' => path_item_string_query, 'globalStringQuery' => @client.global_string_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # send globalStringPath=globalStringPath, - # pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', - # globalStringQuery=null, pathItemStringQuery='pathItemStringQuery', - # localStringQuery=null - # - # @param local_string_path [String] should contain value 'localStringPath' - # @param path_item_string_path [String] A string value 'pathItemStringPath' - # that appears in the path - # @param local_string_query [String] should contain null value - # @param path_item_string_query [String] A string value 'pathItemStringQuery' - # that appears as a query parameter - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_global_and_local_query_null(local_string_path, path_item_string_path, local_string_query = nil, path_item_string_query = nil, custom_headers = nil) - fail ArgumentError, 'local_string_path is nil' if local_string_path.nil? - fail ArgumentError, 'path_item_string_path is nil' if path_item_string_path.nil? - fail ArgumentError, '@client.global_string_path is nil' if @client.global_string_path.nil? - # Construct URL - path = "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/null" - path['{localStringPath}'] = ERB::Util.url_encode(local_string_path) if path.include?('{localStringPath}') - path['{pathItemStringPath}'] = ERB::Util.url_encode(path_item_string_path) if path.include?('{pathItemStringPath}') - path['{globalStringPath}'] = ERB::Util.url_encode(@client.global_string_path) if path.include?('{globalStringPath}') - url = URI.join(@client.base_url, path) - properties = { 'localStringQuery' => local_string_query, 'pathItemStringQuery' => path_item_string_query, 'globalStringQuery' => @client.global_string_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # send globalStringPath='globalStringPath', - # pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', - # globalStringQuery='globalStringQuery', pathItemStringQuery=null, - # localStringQuery=null - # - # @param local_string_path [String] should contain value 'localStringPath' - # @param path_item_string_path [String] A string value 'pathItemStringPath' - # that appears in the path - # @param local_string_query [String] should contain value null - # @param path_item_string_query [String] should contain value null - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_local_path_item_query_null(local_string_path, path_item_string_path, local_string_query = nil, path_item_string_query = nil, custom_headers = nil) - fail ArgumentError, 'local_string_path is nil' if local_string_path.nil? - fail ArgumentError, 'path_item_string_path is nil' if path_item_string_path.nil? - fail ArgumentError, '@client.global_string_path is nil' if @client.global_string_path.nil? - # Construct URL - path = "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/null/null" - path['{localStringPath}'] = ERB::Util.url_encode(local_string_path) if path.include?('{localStringPath}') - path['{pathItemStringPath}'] = ERB::Util.url_encode(path_item_string_path) if path.include?('{pathItemStringPath}') - path['{globalStringPath}'] = ERB::Util.url_encode(@client.global_string_path) if path.include?('{globalStringPath}') - url = URI.join(@client.base_url, path) - properties = { 'localStringQuery' => local_string_query, 'pathItemStringQuery' => path_item_string_query, 'globalStringQuery' => @client.global_string_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_items/url/paths.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_items/url/paths.rb deleted file mode 100644 index d09e76559..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_items/url/paths.rb +++ /dev/null @@ -1,1371 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module UrlModule - # - # Test Infrastructure for AutoRest - # - class Paths - include UrlModule::Models - - # - # Creates and initializes a new instance of the Paths class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestUrlTestService - attr_reader :client - - # - # Get true Boolean value on path - # - # @param bool_path [Boolean] true boolean value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_boolean_true(bool_path, custom_headers = nil) - fail ArgumentError, 'bool_path is nil' if bool_path.nil? - # Construct URL - path = "/paths/bool/true/{boolPath}" - path['{boolPath}'] = ERB::Util.url_encode(bool_path.to_s) if path.include?('{boolPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get false Boolean value on path - # - # @param bool_path [Boolean] false boolean value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_boolean_false(bool_path, custom_headers = nil) - fail ArgumentError, 'bool_path is nil' if bool_path.nil? - # Construct URL - path = "/paths/bool/false/{boolPath}" - path['{boolPath}'] = ERB::Util.url_encode(bool_path.to_s) if path.include?('{boolPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '1000000' integer value - # - # @param int_path [Integer] '1000000' integer value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_int_one_million(int_path, custom_headers = nil) - fail ArgumentError, 'int_path is nil' if int_path.nil? - # Construct URL - path = "/paths/int/1000000/{intPath}" - path['{intPath}'] = ERB::Util.url_encode(int_path.to_s) if path.include?('{intPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '-1000000' integer value - # - # @param int_path [Integer] '-1000000' integer value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_int_negative_one_million(int_path, custom_headers = nil) - fail ArgumentError, 'int_path is nil' if int_path.nil? - # Construct URL - path = "/paths/int/-1000000/{intPath}" - path['{intPath}'] = ERB::Util.url_encode(int_path.to_s) if path.include?('{intPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '10000000000' 64 bit integer value - # - # @param long_path [Integer] '10000000000' 64 bit integer value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_ten_billion(long_path, custom_headers = nil) - fail ArgumentError, 'long_path is nil' if long_path.nil? - # Construct URL - path = "/paths/long/10000000000/{longPath}" - path['{longPath}'] = ERB::Util.url_encode(long_path.to_s) if path.include?('{longPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '-10000000000' 64 bit integer value - # - # @param long_path [Integer] '-10000000000' 64 bit integer value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_negative_ten_billion(long_path, custom_headers = nil) - fail ArgumentError, 'long_path is nil' if long_path.nil? - # Construct URL - path = "/paths/long/-10000000000/{longPath}" - path['{longPath}'] = ERB::Util.url_encode(long_path.to_s) if path.include?('{longPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '1.034E+20' numeric value - # - # @param float_path [Float] '1.034E+20'numeric value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def float_scientific_positive(float_path, custom_headers = nil) - fail ArgumentError, 'float_path is nil' if float_path.nil? - # Construct URL - path = "/paths/float/1.034E+20/{floatPath}" - path['{floatPath}'] = ERB::Util.url_encode(float_path.to_s) if path.include?('{floatPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '-1.034E-20' numeric value - # - # @param float_path [Float] '-1.034E-20'numeric value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def float_scientific_negative(float_path, custom_headers = nil) - fail ArgumentError, 'float_path is nil' if float_path.nil? - # Construct URL - path = "/paths/float/-1.034E-20/{floatPath}" - path['{floatPath}'] = ERB::Util.url_encode(float_path.to_s) if path.include?('{floatPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '9999999.999' numeric value - # - # @param double_path [Float] '9999999.999'numeric value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def double_decimal_positive(double_path, custom_headers = nil) - fail ArgumentError, 'double_path is nil' if double_path.nil? - # Construct URL - path = "/paths/double/9999999.999/{doublePath}" - path['{doublePath}'] = ERB::Util.url_encode(double_path.to_s) if path.include?('{doublePath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '-9999999.999' numeric value - # - # @param double_path [Float] '-9999999.999'numeric value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def double_decimal_negative(double_path, custom_headers = nil) - fail ArgumentError, 'double_path is nil' if double_path.nil? - # Construct URL - path = "/paths/double/-9999999.999/{doublePath}" - path['{doublePath}'] = ERB::Util.url_encode(double_path.to_s) if path.include?('{doublePath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '啊齄丂狛狜隣郎隣兀﨩' multi-byte string value - # - # @param string_path '啊齄丂狛狜隣郎隣兀﨩'multi-byte string value. Possible values for - # this parameter include: '啊齄丂狛狜隣郎隣兀﨩' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def string_unicode(string_path, custom_headers = nil) - fail ArgumentError, 'string_path is nil' if string_path.nil? - # Construct URL - path = "/paths/string/unicode/{stringPath}" - path['{stringPath}'] = ERB::Util.url_encode(string_path.to_s) if path.include?('{stringPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get 'begin!*'();:@ &=+$,/?#[]end - # - # @param string_path 'begin!*'();:@ &=+$,/?#[]end' url encoded string value. - # Possible values for this parameter include: 'begin!*'();:@ &=+$,/?#[]end' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def string_url_encoded(string_path, custom_headers = nil) - fail ArgumentError, 'string_path is nil' if string_path.nil? - # Construct URL - path = "/paths/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend/{stringPath}" - path['{stringPath}'] = ERB::Util.url_encode(string_path.to_s) if path.include?('{stringPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '' - # - # @param string_path '' string value. Possible values for this parameter - # include: '' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def string_empty(string_path, custom_headers = nil) - fail ArgumentError, 'string_path is nil' if string_path.nil? - # Construct URL - path = "/paths/string/empty/{stringPath}" - path['{stringPath}'] = ERB::Util.url_encode(string_path.to_s) if path.include?('{stringPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null (should throw) - # - # @param string_path [String] null string value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def string_null(string_path, custom_headers = nil) - fail ArgumentError, 'string_path is nil' if string_path.nil? - # Construct URL - path = "/paths/string/null/{stringPath}" - path['{stringPath}'] = ERB::Util.url_encode(string_path) if path.include?('{stringPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 400) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get using uri with 'green color' in path parameter - # - # @param enum_path [UriColor] send the value green. Possible values for this - # parameter include: 'red color', 'green color', 'blue color' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def enum_valid(enum_path, custom_headers = nil) - fail ArgumentError, 'enum_path is nil' if enum_path.nil? - # Construct URL - path = "/paths/enum/green%20color/{enumPath}" - path['{enumPath}'] = ERB::Util.url_encode(enum_path.to_s) if path.include?('{enumPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null (should throw on the client before the request is sent on wire) - # - # @param enum_path [UriColor] send null should throw. Possible values for this - # parameter include: 'red color', 'green color', 'blue color' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def enum_null(enum_path, custom_headers = nil) - fail ArgumentError, 'enum_path is nil' if enum_path.nil? - # Construct URL - path = "/paths/string/null/{enumPath}" - path['{enumPath}'] = ERB::Util.url_encode(enum_path.to_s) if path.include?('{enumPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 400) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array - # - # @param byte_path [Array] '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 - # encoded byte array - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def byte_multi_byte(byte_path, custom_headers = nil) - fail ArgumentError, 'byte_path is nil' if byte_path.nil? - # Construct URL - path = "/paths/byte/multibyte/{bytePath}" - path['{bytePath}'] = ERB::Util.url_encode(byte_path.to_s) if path.include?('{bytePath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '' as byte array - # - # @param byte_path [Array] '' as byte array - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def byte_empty(byte_path, custom_headers = nil) - fail ArgumentError, 'byte_path is nil' if byte_path.nil? - # Construct URL - path = "/paths/byte/empty/{bytePath}" - path['{bytePath}'] = ERB::Util.url_encode(byte_path.to_s) if path.include?('{bytePath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null as byte array (should throw) - # - # @param byte_path [Array] null as byte array (should throw) - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def byte_null(byte_path, custom_headers = nil) - fail ArgumentError, 'byte_path is nil' if byte_path.nil? - # Construct URL - path = "/paths/byte/null/{bytePath}" - path['{bytePath}'] = ERB::Util.url_encode(byte_path.to_s) if path.include?('{bytePath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 400) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '2012-01-01' as date - # - # @param date_path [Date] '2012-01-01' as date - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def date_valid(date_path, custom_headers = nil) - fail ArgumentError, 'date_path is nil' if date_path.nil? - # Construct URL - path = "/paths/date/2012-01-01/{datePath}" - path['{datePath}'] = ERB::Util.url_encode(date_path.to_s) if path.include?('{datePath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null as date - this should throw or be unusable on the client side, - # depending on date representation - # - # @param date_path [Date] null as date (should throw) - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def date_null(date_path, custom_headers = nil) - fail ArgumentError, 'date_path is nil' if date_path.nil? - # Construct URL - path = "/paths/date/null/{datePath}" - path['{datePath}'] = ERB::Util.url_encode(date_path.to_s) if path.include?('{datePath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 400) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '2012-01-01T01:01:01Z' as date-time - # - # @param date_time_path [DateTime] '2012-01-01T01:01:01Z' as date-time - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def date_time_valid(date_time_path, custom_headers = nil) - fail ArgumentError, 'date_time_path is nil' if date_time_path.nil? - # Construct URL - path = "/paths/datetime/2012-01-01T01%3A01%3A01Z/{dateTimePath}" - path['{dateTimePath}'] = ERB::Util.url_encode(date_time_path.to_s) if path.include?('{dateTimePath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null as date-time, should be disallowed or throw depending on - # representation of date-time - # - # @param date_time_path [DateTime] null as date-time - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def date_time_null(date_time_path, custom_headers = nil) - fail ArgumentError, 'date_time_path is nil' if date_time_path.nil? - # Construct URL - path = "/paths/datetime/null/{dateTimePath}" - path['{dateTimePath}'] = ERB::Util.url_encode(date_time_path.to_s) if path.include?('{dateTimePath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 400) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_items/url/queries.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_items/url/queries.rb deleted file mode 100644 index 168830010..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_items/url/queries.rb +++ /dev/null @@ -1,2262 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module UrlModule - # - # Test Infrastructure for AutoRest - # - class Queries - include UrlModule::Models - - # - # Creates and initializes a new instance of the Queries class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestUrlTestService - attr_reader :client - - # - # Get true Boolean value on path - # - # @param bool_query [Boolean] true boolean value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_boolean_true(bool_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/bool/true" - url = URI.join(@client.base_url, path) - properties = { 'boolQuery' => bool_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get false Boolean value on path - # - # @param bool_query [Boolean] false boolean value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_boolean_false(bool_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/bool/false" - url = URI.join(@client.base_url, path) - properties = { 'boolQuery' => bool_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null Boolean value on query (query string should be absent) - # - # @param bool_query [Boolean] null boolean value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_boolean_null(bool_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/bool/null" - url = URI.join(@client.base_url, path) - properties = { 'boolQuery' => bool_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '1000000' integer value - # - # @param int_query [Integer] '1000000' integer value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_int_one_million(int_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/int/1000000" - url = URI.join(@client.base_url, path) - properties = { 'intQuery' => int_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '-1000000' integer value - # - # @param int_query [Integer] '-1000000' integer value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_int_negative_one_million(int_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/int/-1000000" - url = URI.join(@client.base_url, path) - properties = { 'intQuery' => int_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null integer value (no query parameter) - # - # @param int_query [Integer] null integer value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_int_null(int_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/int/null" - url = URI.join(@client.base_url, path) - properties = { 'intQuery' => int_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '10000000000' 64 bit integer value - # - # @param long_query [Integer] '10000000000' 64 bit integer value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_ten_billion(long_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/long/10000000000" - url = URI.join(@client.base_url, path) - properties = { 'longQuery' => long_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '-10000000000' 64 bit integer value - # - # @param long_query [Integer] '-10000000000' 64 bit integer value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_negative_ten_billion(long_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/long/-10000000000" - url = URI.join(@client.base_url, path) - properties = { 'longQuery' => long_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get 'null 64 bit integer value (no query param in uri) - # - # @param long_query [Integer] null 64 bit integer value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_long_null(long_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/long/null" - url = URI.join(@client.base_url, path) - properties = { 'longQuery' => long_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '1.034E+20' numeric value - # - # @param float_query [Float] '1.034E+20'numeric value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def float_scientific_positive(float_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/float/1.034E+20" - url = URI.join(@client.base_url, path) - properties = { 'floatQuery' => float_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '-1.034E-20' numeric value - # - # @param float_query [Float] '-1.034E-20'numeric value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def float_scientific_negative(float_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/float/-1.034E-20" - url = URI.join(@client.base_url, path) - properties = { 'floatQuery' => float_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null numeric value (no query parameter) - # - # @param float_query [Float] null numeric value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def float_null(float_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/float/null" - url = URI.join(@client.base_url, path) - properties = { 'floatQuery' => float_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '9999999.999' numeric value - # - # @param double_query [Float] '9999999.999'numeric value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def double_decimal_positive(double_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/double/9999999.999" - url = URI.join(@client.base_url, path) - properties = { 'doubleQuery' => double_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '-9999999.999' numeric value - # - # @param double_query [Float] '-9999999.999'numeric value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def double_decimal_negative(double_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/double/-9999999.999" - url = URI.join(@client.base_url, path) - properties = { 'doubleQuery' => double_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null numeric value (no query parameter) - # - # @param double_query [Float] null numeric value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def double_null(double_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/double/null" - url = URI.join(@client.base_url, path) - properties = { 'doubleQuery' => double_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '啊齄丂狛狜隣郎隣兀﨩' multi-byte string value - # - # @param string_query '啊齄丂狛狜隣郎隣兀﨩'multi-byte string value. Possible values for - # this parameter include: '啊齄丂狛狜隣郎隣兀﨩' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def string_unicode(string_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/string/unicode/" - url = URI.join(@client.base_url, path) - properties = { 'stringQuery' => string_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get 'begin!*'();:@ &=+$,/?#[]end - # - # @param string_query 'begin!*'();:@ &=+$,/?#[]end' url encoded string value. - # Possible values for this parameter include: 'begin!*'();:@ &=+$,/?#[]end' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def string_url_encoded(string_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend" - url = URI.join(@client.base_url, path) - properties = { 'stringQuery' => string_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '' - # - # @param string_query '' string value. Possible values for this parameter - # include: '' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def string_empty(string_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/string/empty" - url = URI.join(@client.base_url, path) - properties = { 'stringQuery' => string_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null (no query parameter in url) - # - # @param string_query [String] null string value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def string_null(string_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/string/null" - url = URI.join(@client.base_url, path) - properties = { 'stringQuery' => string_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get using uri with query parameter 'green color' - # - # @param enum_query [UriColor] 'green color' enum value. Possible values for - # this parameter include: 'red color', 'green color', 'blue color' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def enum_valid(enum_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/enum/green%20color" - url = URI.join(@client.base_url, path) - properties = { 'enumQuery' => enum_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null (no query parameter in url) - # - # @param enum_query [UriColor] null string value. Possible values for this - # parameter include: 'red color', 'green color', 'blue color' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def enum_null(enum_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/enum/null" - url = URI.join(@client.base_url, path) - properties = { 'enumQuery' => enum_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array - # - # @param byte_query [Array] '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 - # encoded byte array - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def byte_multi_byte(byte_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/byte/multibyte" - url = URI.join(@client.base_url, path) - properties = { 'byteQuery' => byte_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '' as byte array - # - # @param byte_query [Array] '' as byte array - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def byte_empty(byte_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/byte/empty" - url = URI.join(@client.base_url, path) - properties = { 'byteQuery' => byte_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null as byte array (no query parameters in uri) - # - # @param byte_query [Array] null as byte array (no query parameters - # in uri) - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def byte_null(byte_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/byte/null" - url = URI.join(@client.base_url, path) - properties = { 'byteQuery' => byte_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '2012-01-01' as date - # - # @param date_query [Date] '2012-01-01' as date - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def date_valid(date_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/date/2012-01-01" - url = URI.join(@client.base_url, path) - properties = { 'dateQuery' => date_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null as date - this should result in no query parameters in uri - # - # @param date_query [Date] null as date (no query parameters in uri) - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def date_null(date_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/date/null" - url = URI.join(@client.base_url, path) - properties = { 'dateQuery' => date_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '2012-01-01T01:01:01Z' as date-time - # - # @param date_time_query [DateTime] '2012-01-01T01:01:01Z' as date-time - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def date_time_valid(date_time_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/datetime/2012-01-01T01%3A01%3A01Z" - url = URI.join(@client.base_url, path) - properties = { 'dateTimeQuery' => date_time_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null as date-time, should result in no query parameters in uri - # - # @param date_time_query [DateTime] null as date-time (no query parameters) - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def date_time_null(date_time_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/datetime/null" - url = URI.join(@client.base_url, path) - properties = { 'dateTimeQuery' => date_time_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, - # ''] using the csv-array format - # - # @param array_query [Array] an array of string ['ArrayQuery1', - # 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the csv-array format - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def array_string_csv_valid(array_query = nil, custom_headers = nil) - array_query.each{ |e| e.validate if e.respond_to?(:validate) } unless array_query.nil? - # Construct URL - path = "/queries/array/csv/string/valid" - url = URI.join(@client.base_url, path) - properties = { 'arrayQuery' => array_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get a null array of string using the csv-array format - # - # @param array_query [Array] a null array of string using the - # csv-array format - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def array_string_csv_null(array_query = nil, custom_headers = nil) - array_query.each{ |e| e.validate if e.respond_to?(:validate) } unless array_query.nil? - # Construct URL - path = "/queries/array/csv/string/null" - url = URI.join(@client.base_url, path) - properties = { 'arrayQuery' => array_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get an empty array [] of string using the csv-array format - # - # @param array_query [Array] an empty array [] of string using the - # csv-array format - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def array_string_csv_empty(array_query = nil, custom_headers = nil) - array_query.each{ |e| e.validate if e.respond_to?(:validate) } unless array_query.nil? - # Construct URL - path = "/queries/array/csv/string/empty" - url = URI.join(@client.base_url, path) - properties = { 'arrayQuery' => array_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, - # ''] using the ssv-array format - # - # @param array_query [Array] an array of string ['ArrayQuery1', - # 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the ssv-array format - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def array_string_ssv_valid(array_query = nil, custom_headers = nil) - array_query.each{ |e| e.validate if e.respond_to?(:validate) } unless array_query.nil? - # Construct URL - path = "/queries/array/ssv/string/valid" - url = URI.join(@client.base_url, path) - properties = { 'arrayQuery' => array_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, - # ''] using the tsv-array format - # - # @param array_query [Array] an array of string ['ArrayQuery1', - # 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the tsv-array format - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def array_string_tsv_valid(array_query = nil, custom_headers = nil) - array_query.each{ |e| e.validate if e.respond_to?(:validate) } unless array_query.nil? - # Construct URL - path = "/queries/array/tsv/string/valid" - url = URI.join(@client.base_url, path) - properties = { 'arrayQuery' => array_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, - # ''] using the pipes-array format - # - # @param array_query [Array] an array of string ['ArrayQuery1', - # 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the pipes-array format - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def array_string_pipes_valid(array_query = nil, custom_headers = nil) - array_query.each{ |e| e.validate if e.respond_to?(:validate) } unless array_query.nil? - # Construct URL - path = "/queries/array/pipes/string/valid" - url = URI.join(@client.base_url, path) - properties = { 'arrayQuery' => array_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_query/url.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_query/url.rb deleted file mode 100644 index 83af1c6cd..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_query/url.rb +++ /dev/null @@ -1,34 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -require 'uri' -require 'cgi' -require 'date' -require 'json' -require 'base64' -require 'erb' -require 'securerandom' -require 'time' -require 'timeliness' -require 'faraday' -require 'faraday-cookie_jar' -require 'concurrent' -require 'ms_rest' - -module UrlModule - autoload :Paths, 'url/paths.rb' - autoload :Queries, 'url/queries.rb' - autoload :PathItems, 'url/path_items.rb' - autoload :AutoRestUrlTestService, 'url/auto_rest_url_test_service.rb' - - module Models - autoload :Error, 'url/models/error.rb' - autoload :UriColor, 'url/models/uri_color.rb' - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_query/url/auto_rest_url_test_service.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_query/url/auto_rest_url_test_service.rb deleted file mode 100644 index 039ca1b09..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_query/url/auto_rest_url_test_service.rb +++ /dev/null @@ -1,56 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module UrlModule - # - # A service client - single point of access to the REST API. - # - class AutoRestUrlTestService < MsRest::ServiceClient - include UrlModule::Models - - # @return [String] the base URI of the service. - attr_accessor :base_url - - # @return [String] A string value 'globalItemStringPath' that appears in - # the path - attr_accessor :global_string_path - - # @return [String] should contain value null - attr_accessor :global_string_query - - # @return paths - attr_reader :paths - - # @return queries - attr_reader :queries - - # @return path_items - attr_reader :path_items - - # - # Creates initializes a new instance of the AutoRestUrlTestService class. - # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. - # @param base_url [String] the base URI of the service. - # @param options [Array] filters to be applied to the HTTP requests. - # - def initialize(credentials, base_url = nil, options = nil) - super(credentials, options) - @base_url = base_url || 'http://localhost' - - fail ArgumentError, 'credentials is nil' if credentials.nil? - fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) - @credentials = credentials - - @paths = Paths.new(self) - @queries = Queries.new(self) - @path_items = PathItems.new(self) - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_query/url/models/error.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_query/url/models/error.rb deleted file mode 100644 index f1453515c..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_query/url/models/error.rb +++ /dev/null @@ -1,69 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module UrlModule - module Models - # - # Model object. - # - class Error - # @return [Integer] - attr_accessor :status - - # @return [String] - attr_accessor :message - - # - # Validate the object. Throws ValidationError if validation fails. - # - def validate - # Nothing to validate - end - - # - # Serializes given Model object into Ruby Hash. - # @param object Model object to serialize. - # @return [Hash] Serialized object in form of Ruby Hash. - # - def self.serialize_object(object) - object.validate - output_object = {} - - serialized_property = object.status - output_object['status'] = serialized_property unless serialized_property.nil? - - serialized_property = object.message - output_object['message'] = serialized_property unless serialized_property.nil? - - output_object - end - - # - # Deserializes given Ruby Hash into Model object. - # @param object [Hash] Ruby Hash object to deserialize. - # @return [Error] Deserialized object. - # - def self.deserialize_object(object) - return if object.nil? - output_object = Error.new - - deserialized_property = object['status'] - deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? - output_object.status = deserialized_property - - deserialized_property = object['message'] - output_object.message = deserialized_property - - output_object.validate - - output_object - end - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_query/url/models/uri_color.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_query/url/models/uri_color.rb deleted file mode 100644 index 1d155a31d..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_query/url/models/uri_color.rb +++ /dev/null @@ -1,21 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module UrlModule - module Models - # - # Defines values for UriColor - # - module UriColor - Redcolor = "red color" - Greencolor = "green color" - Bluecolor = "blue color" - end - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_query/url/path_items.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_query/url/path_items.rb deleted file mode 100644 index f0d9cdc6a..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_query/url/path_items.rb +++ /dev/null @@ -1,345 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module UrlModule - # - # Test Infrastructure for AutoRest - # - class PathItems - include UrlModule::Models - - # - # Creates and initializes a new instance of the PathItems class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestUrlTestService - attr_reader :client - - # - # send globalStringPath='globalStringPath', - # pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', - # globalStringQuery='globalStringQuery', - # pathItemStringQuery='pathItemStringQuery', - # localStringQuery='localStringQuery' - # - # @param local_string_path [String] should contain value 'localStringPath' - # @param path_item_string_path [String] A string value 'pathItemStringPath' - # that appears in the path - # @param local_string_query [String] should contain value 'localStringQuery' - # @param path_item_string_query [String] A string value 'pathItemStringQuery' - # that appears as a query parameter - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_all_with_values(local_string_path, path_item_string_path, local_string_query = nil, path_item_string_query = nil, custom_headers = nil) - fail ArgumentError, 'local_string_path is nil' if local_string_path.nil? - fail ArgumentError, 'path_item_string_path is nil' if path_item_string_path.nil? - fail ArgumentError, '@client.global_string_path is nil' if @client.global_string_path.nil? - # Construct URL - path = "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/pathItemStringQuery/localStringQuery" - path['{localStringPath}'] = ERB::Util.url_encode(local_string_path) if path.include?('{localStringPath}') - path['{pathItemStringPath}'] = ERB::Util.url_encode(path_item_string_path) if path.include?('{pathItemStringPath}') - path['{globalStringPath}'] = ERB::Util.url_encode(@client.global_string_path) if path.include?('{globalStringPath}') - url = URI.join(@client.base_url, path) - properties = { 'localStringQuery' => local_string_query, 'pathItemStringQuery' => path_item_string_query, 'globalStringQuery' => @client.global_string_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # send globalStringPath='globalStringPath', - # pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', - # globalStringQuery=null, pathItemStringQuery='pathItemStringQuery', - # localStringQuery='localStringQuery' - # - # @param local_string_path [String] should contain value 'localStringPath' - # @param path_item_string_path [String] A string value 'pathItemStringPath' - # that appears in the path - # @param local_string_query [String] should contain value 'localStringQuery' - # @param path_item_string_query [String] A string value 'pathItemStringQuery' - # that appears as a query parameter - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_global_query_null(local_string_path, path_item_string_path, local_string_query = nil, path_item_string_query = nil, custom_headers = nil) - fail ArgumentError, 'local_string_path is nil' if local_string_path.nil? - fail ArgumentError, 'path_item_string_path is nil' if path_item_string_path.nil? - fail ArgumentError, '@client.global_string_path is nil' if @client.global_string_path.nil? - # Construct URL - path = "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/localStringQuery" - path['{localStringPath}'] = ERB::Util.url_encode(local_string_path) if path.include?('{localStringPath}') - path['{pathItemStringPath}'] = ERB::Util.url_encode(path_item_string_path) if path.include?('{pathItemStringPath}') - path['{globalStringPath}'] = ERB::Util.url_encode(@client.global_string_path) if path.include?('{globalStringPath}') - url = URI.join(@client.base_url, path) - properties = { 'localStringQuery' => local_string_query, 'pathItemStringQuery' => path_item_string_query, 'globalStringQuery' => @client.global_string_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # send globalStringPath=globalStringPath, - # pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', - # globalStringQuery=null, pathItemStringQuery='pathItemStringQuery', - # localStringQuery=null - # - # @param local_string_path [String] should contain value 'localStringPath' - # @param path_item_string_path [String] A string value 'pathItemStringPath' - # that appears in the path - # @param local_string_query [String] should contain null value - # @param path_item_string_query [String] A string value 'pathItemStringQuery' - # that appears as a query parameter - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_global_and_local_query_null(local_string_path, path_item_string_path, local_string_query = nil, path_item_string_query = nil, custom_headers = nil) - fail ArgumentError, 'local_string_path is nil' if local_string_path.nil? - fail ArgumentError, 'path_item_string_path is nil' if path_item_string_path.nil? - fail ArgumentError, '@client.global_string_path is nil' if @client.global_string_path.nil? - # Construct URL - path = "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/null" - path['{localStringPath}'] = ERB::Util.url_encode(local_string_path) if path.include?('{localStringPath}') - path['{pathItemStringPath}'] = ERB::Util.url_encode(path_item_string_path) if path.include?('{pathItemStringPath}') - path['{globalStringPath}'] = ERB::Util.url_encode(@client.global_string_path) if path.include?('{globalStringPath}') - url = URI.join(@client.base_url, path) - properties = { 'localStringQuery' => local_string_query, 'pathItemStringQuery' => path_item_string_query, 'globalStringQuery' => @client.global_string_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # send globalStringPath='globalStringPath', - # pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', - # globalStringQuery='globalStringQuery', pathItemStringQuery=null, - # localStringQuery=null - # - # @param local_string_path [String] should contain value 'localStringPath' - # @param path_item_string_path [String] A string value 'pathItemStringPath' - # that appears in the path - # @param local_string_query [String] should contain value null - # @param path_item_string_query [String] should contain value null - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_local_path_item_query_null(local_string_path, path_item_string_path, local_string_query = nil, path_item_string_query = nil, custom_headers = nil) - fail ArgumentError, 'local_string_path is nil' if local_string_path.nil? - fail ArgumentError, 'path_item_string_path is nil' if path_item_string_path.nil? - fail ArgumentError, '@client.global_string_path is nil' if @client.global_string_path.nil? - # Construct URL - path = "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/null/null" - path['{localStringPath}'] = ERB::Util.url_encode(local_string_path) if path.include?('{localStringPath}') - path['{pathItemStringPath}'] = ERB::Util.url_encode(path_item_string_path) if path.include?('{pathItemStringPath}') - path['{globalStringPath}'] = ERB::Util.url_encode(@client.global_string_path) if path.include?('{globalStringPath}') - url = URI.join(@client.base_url, path) - properties = { 'localStringQuery' => local_string_query, 'pathItemStringQuery' => path_item_string_query, 'globalStringQuery' => @client.global_string_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_query/url/paths.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_query/url/paths.rb deleted file mode 100644 index d09e76559..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_query/url/paths.rb +++ /dev/null @@ -1,1371 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module UrlModule - # - # Test Infrastructure for AutoRest - # - class Paths - include UrlModule::Models - - # - # Creates and initializes a new instance of the Paths class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestUrlTestService - attr_reader :client - - # - # Get true Boolean value on path - # - # @param bool_path [Boolean] true boolean value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_boolean_true(bool_path, custom_headers = nil) - fail ArgumentError, 'bool_path is nil' if bool_path.nil? - # Construct URL - path = "/paths/bool/true/{boolPath}" - path['{boolPath}'] = ERB::Util.url_encode(bool_path.to_s) if path.include?('{boolPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get false Boolean value on path - # - # @param bool_path [Boolean] false boolean value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_boolean_false(bool_path, custom_headers = nil) - fail ArgumentError, 'bool_path is nil' if bool_path.nil? - # Construct URL - path = "/paths/bool/false/{boolPath}" - path['{boolPath}'] = ERB::Util.url_encode(bool_path.to_s) if path.include?('{boolPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '1000000' integer value - # - # @param int_path [Integer] '1000000' integer value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_int_one_million(int_path, custom_headers = nil) - fail ArgumentError, 'int_path is nil' if int_path.nil? - # Construct URL - path = "/paths/int/1000000/{intPath}" - path['{intPath}'] = ERB::Util.url_encode(int_path.to_s) if path.include?('{intPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '-1000000' integer value - # - # @param int_path [Integer] '-1000000' integer value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_int_negative_one_million(int_path, custom_headers = nil) - fail ArgumentError, 'int_path is nil' if int_path.nil? - # Construct URL - path = "/paths/int/-1000000/{intPath}" - path['{intPath}'] = ERB::Util.url_encode(int_path.to_s) if path.include?('{intPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '10000000000' 64 bit integer value - # - # @param long_path [Integer] '10000000000' 64 bit integer value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_ten_billion(long_path, custom_headers = nil) - fail ArgumentError, 'long_path is nil' if long_path.nil? - # Construct URL - path = "/paths/long/10000000000/{longPath}" - path['{longPath}'] = ERB::Util.url_encode(long_path.to_s) if path.include?('{longPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '-10000000000' 64 bit integer value - # - # @param long_path [Integer] '-10000000000' 64 bit integer value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_negative_ten_billion(long_path, custom_headers = nil) - fail ArgumentError, 'long_path is nil' if long_path.nil? - # Construct URL - path = "/paths/long/-10000000000/{longPath}" - path['{longPath}'] = ERB::Util.url_encode(long_path.to_s) if path.include?('{longPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '1.034E+20' numeric value - # - # @param float_path [Float] '1.034E+20'numeric value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def float_scientific_positive(float_path, custom_headers = nil) - fail ArgumentError, 'float_path is nil' if float_path.nil? - # Construct URL - path = "/paths/float/1.034E+20/{floatPath}" - path['{floatPath}'] = ERB::Util.url_encode(float_path.to_s) if path.include?('{floatPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '-1.034E-20' numeric value - # - # @param float_path [Float] '-1.034E-20'numeric value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def float_scientific_negative(float_path, custom_headers = nil) - fail ArgumentError, 'float_path is nil' if float_path.nil? - # Construct URL - path = "/paths/float/-1.034E-20/{floatPath}" - path['{floatPath}'] = ERB::Util.url_encode(float_path.to_s) if path.include?('{floatPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '9999999.999' numeric value - # - # @param double_path [Float] '9999999.999'numeric value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def double_decimal_positive(double_path, custom_headers = nil) - fail ArgumentError, 'double_path is nil' if double_path.nil? - # Construct URL - path = "/paths/double/9999999.999/{doublePath}" - path['{doublePath}'] = ERB::Util.url_encode(double_path.to_s) if path.include?('{doublePath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '-9999999.999' numeric value - # - # @param double_path [Float] '-9999999.999'numeric value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def double_decimal_negative(double_path, custom_headers = nil) - fail ArgumentError, 'double_path is nil' if double_path.nil? - # Construct URL - path = "/paths/double/-9999999.999/{doublePath}" - path['{doublePath}'] = ERB::Util.url_encode(double_path.to_s) if path.include?('{doublePath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '啊齄丂狛狜隣郎隣兀﨩' multi-byte string value - # - # @param string_path '啊齄丂狛狜隣郎隣兀﨩'multi-byte string value. Possible values for - # this parameter include: '啊齄丂狛狜隣郎隣兀﨩' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def string_unicode(string_path, custom_headers = nil) - fail ArgumentError, 'string_path is nil' if string_path.nil? - # Construct URL - path = "/paths/string/unicode/{stringPath}" - path['{stringPath}'] = ERB::Util.url_encode(string_path.to_s) if path.include?('{stringPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get 'begin!*'();:@ &=+$,/?#[]end - # - # @param string_path 'begin!*'();:@ &=+$,/?#[]end' url encoded string value. - # Possible values for this parameter include: 'begin!*'();:@ &=+$,/?#[]end' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def string_url_encoded(string_path, custom_headers = nil) - fail ArgumentError, 'string_path is nil' if string_path.nil? - # Construct URL - path = "/paths/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend/{stringPath}" - path['{stringPath}'] = ERB::Util.url_encode(string_path.to_s) if path.include?('{stringPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '' - # - # @param string_path '' string value. Possible values for this parameter - # include: '' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def string_empty(string_path, custom_headers = nil) - fail ArgumentError, 'string_path is nil' if string_path.nil? - # Construct URL - path = "/paths/string/empty/{stringPath}" - path['{stringPath}'] = ERB::Util.url_encode(string_path.to_s) if path.include?('{stringPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null (should throw) - # - # @param string_path [String] null string value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def string_null(string_path, custom_headers = nil) - fail ArgumentError, 'string_path is nil' if string_path.nil? - # Construct URL - path = "/paths/string/null/{stringPath}" - path['{stringPath}'] = ERB::Util.url_encode(string_path) if path.include?('{stringPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 400) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get using uri with 'green color' in path parameter - # - # @param enum_path [UriColor] send the value green. Possible values for this - # parameter include: 'red color', 'green color', 'blue color' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def enum_valid(enum_path, custom_headers = nil) - fail ArgumentError, 'enum_path is nil' if enum_path.nil? - # Construct URL - path = "/paths/enum/green%20color/{enumPath}" - path['{enumPath}'] = ERB::Util.url_encode(enum_path.to_s) if path.include?('{enumPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null (should throw on the client before the request is sent on wire) - # - # @param enum_path [UriColor] send null should throw. Possible values for this - # parameter include: 'red color', 'green color', 'blue color' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def enum_null(enum_path, custom_headers = nil) - fail ArgumentError, 'enum_path is nil' if enum_path.nil? - # Construct URL - path = "/paths/string/null/{enumPath}" - path['{enumPath}'] = ERB::Util.url_encode(enum_path.to_s) if path.include?('{enumPath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 400) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array - # - # @param byte_path [Array] '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 - # encoded byte array - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def byte_multi_byte(byte_path, custom_headers = nil) - fail ArgumentError, 'byte_path is nil' if byte_path.nil? - # Construct URL - path = "/paths/byte/multibyte/{bytePath}" - path['{bytePath}'] = ERB::Util.url_encode(byte_path.to_s) if path.include?('{bytePath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '' as byte array - # - # @param byte_path [Array] '' as byte array - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def byte_empty(byte_path, custom_headers = nil) - fail ArgumentError, 'byte_path is nil' if byte_path.nil? - # Construct URL - path = "/paths/byte/empty/{bytePath}" - path['{bytePath}'] = ERB::Util.url_encode(byte_path.to_s) if path.include?('{bytePath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null as byte array (should throw) - # - # @param byte_path [Array] null as byte array (should throw) - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def byte_null(byte_path, custom_headers = nil) - fail ArgumentError, 'byte_path is nil' if byte_path.nil? - # Construct URL - path = "/paths/byte/null/{bytePath}" - path['{bytePath}'] = ERB::Util.url_encode(byte_path.to_s) if path.include?('{bytePath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 400) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '2012-01-01' as date - # - # @param date_path [Date] '2012-01-01' as date - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def date_valid(date_path, custom_headers = nil) - fail ArgumentError, 'date_path is nil' if date_path.nil? - # Construct URL - path = "/paths/date/2012-01-01/{datePath}" - path['{datePath}'] = ERB::Util.url_encode(date_path.to_s) if path.include?('{datePath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null as date - this should throw or be unusable on the client side, - # depending on date representation - # - # @param date_path [Date] null as date (should throw) - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def date_null(date_path, custom_headers = nil) - fail ArgumentError, 'date_path is nil' if date_path.nil? - # Construct URL - path = "/paths/date/null/{datePath}" - path['{datePath}'] = ERB::Util.url_encode(date_path.to_s) if path.include?('{datePath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 400) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '2012-01-01T01:01:01Z' as date-time - # - # @param date_time_path [DateTime] '2012-01-01T01:01:01Z' as date-time - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def date_time_valid(date_time_path, custom_headers = nil) - fail ArgumentError, 'date_time_path is nil' if date_time_path.nil? - # Construct URL - path = "/paths/datetime/2012-01-01T01%3A01%3A01Z/{dateTimePath}" - path['{dateTimePath}'] = ERB::Util.url_encode(date_time_path.to_s) if path.include?('{dateTimePath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null as date-time, should be disallowed or throw depending on - # representation of date-time - # - # @param date_time_path [DateTime] null as date-time - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def date_time_null(date_time_path, custom_headers = nil) - fail ArgumentError, 'date_time_path is nil' if date_time_path.nil? - # Construct URL - path = "/paths/datetime/null/{dateTimePath}" - path['{dateTimePath}'] = ERB::Util.url_encode(date_time_path.to_s) if path.include?('{dateTimePath}') - url = URI.join(@client.base_url, path) - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 400) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - end -end diff --git a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_query/url/queries.rb b/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_query/url/queries.rb deleted file mode 100644 index 168830010..000000000 --- a/AutoRest/Generators/Ruby/Ruby.Tests/RspecTests/Generated/url_query/url/queries.rb +++ /dev/null @@ -1,2262 +0,0 @@ -# encoding: 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 0.13.0.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module UrlModule - # - # Test Infrastructure for AutoRest - # - class Queries - include UrlModule::Models - - # - # Creates and initializes a new instance of the Queries class. - # @param client service class for accessing basic functionality. - # - def initialize(client) - @client = client - end - - # @return reference to the AutoRestUrlTestService - attr_reader :client - - # - # Get true Boolean value on path - # - # @param bool_query [Boolean] true boolean value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_boolean_true(bool_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/bool/true" - url = URI.join(@client.base_url, path) - properties = { 'boolQuery' => bool_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get false Boolean value on path - # - # @param bool_query [Boolean] false boolean value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_boolean_false(bool_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/bool/false" - url = URI.join(@client.base_url, path) - properties = { 'boolQuery' => bool_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null Boolean value on query (query string should be absent) - # - # @param bool_query [Boolean] null boolean value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_boolean_null(bool_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/bool/null" - url = URI.join(@client.base_url, path) - properties = { 'boolQuery' => bool_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '1000000' integer value - # - # @param int_query [Integer] '1000000' integer value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_int_one_million(int_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/int/1000000" - url = URI.join(@client.base_url, path) - properties = { 'intQuery' => int_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '-1000000' integer value - # - # @param int_query [Integer] '-1000000' integer value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_int_negative_one_million(int_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/int/-1000000" - url = URI.join(@client.base_url, path) - properties = { 'intQuery' => int_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null integer value (no query parameter) - # - # @param int_query [Integer] null integer value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_int_null(int_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/int/null" - url = URI.join(@client.base_url, path) - properties = { 'intQuery' => int_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '10000000000' 64 bit integer value - # - # @param long_query [Integer] '10000000000' 64 bit integer value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_ten_billion(long_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/long/10000000000" - url = URI.join(@client.base_url, path) - properties = { 'longQuery' => long_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '-10000000000' 64 bit integer value - # - # @param long_query [Integer] '-10000000000' 64 bit integer value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_negative_ten_billion(long_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/long/-10000000000" - url = URI.join(@client.base_url, path) - properties = { 'longQuery' => long_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get 'null 64 bit integer value (no query param in uri) - # - # @param long_query [Integer] null 64 bit integer value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def get_long_null(long_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/long/null" - url = URI.join(@client.base_url, path) - properties = { 'longQuery' => long_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '1.034E+20' numeric value - # - # @param float_query [Float] '1.034E+20'numeric value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def float_scientific_positive(float_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/float/1.034E+20" - url = URI.join(@client.base_url, path) - properties = { 'floatQuery' => float_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '-1.034E-20' numeric value - # - # @param float_query [Float] '-1.034E-20'numeric value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def float_scientific_negative(float_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/float/-1.034E-20" - url = URI.join(@client.base_url, path) - properties = { 'floatQuery' => float_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null numeric value (no query parameter) - # - # @param float_query [Float] null numeric value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def float_null(float_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/float/null" - url = URI.join(@client.base_url, path) - properties = { 'floatQuery' => float_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '9999999.999' numeric value - # - # @param double_query [Float] '9999999.999'numeric value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def double_decimal_positive(double_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/double/9999999.999" - url = URI.join(@client.base_url, path) - properties = { 'doubleQuery' => double_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '-9999999.999' numeric value - # - # @param double_query [Float] '-9999999.999'numeric value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def double_decimal_negative(double_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/double/-9999999.999" - url = URI.join(@client.base_url, path) - properties = { 'doubleQuery' => double_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null numeric value (no query parameter) - # - # @param double_query [Float] null numeric value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def double_null(double_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/double/null" - url = URI.join(@client.base_url, path) - properties = { 'doubleQuery' => double_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '啊齄丂狛狜隣郎隣兀﨩' multi-byte string value - # - # @param string_query '啊齄丂狛狜隣郎隣兀﨩'multi-byte string value. Possible values for - # this parameter include: '啊齄丂狛狜隣郎隣兀﨩' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def string_unicode(string_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/string/unicode/" - url = URI.join(@client.base_url, path) - properties = { 'stringQuery' => string_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get 'begin!*'();:@ &=+$,/?#[]end - # - # @param string_query 'begin!*'();:@ &=+$,/?#[]end' url encoded string value. - # Possible values for this parameter include: 'begin!*'();:@ &=+$,/?#[]end' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def string_url_encoded(string_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend" - url = URI.join(@client.base_url, path) - properties = { 'stringQuery' => string_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '' - # - # @param string_query '' string value. Possible values for this parameter - # include: '' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def string_empty(string_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/string/empty" - url = URI.join(@client.base_url, path) - properties = { 'stringQuery' => string_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null (no query parameter in url) - # - # @param string_query [String] null string value - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def string_null(string_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/string/null" - url = URI.join(@client.base_url, path) - properties = { 'stringQuery' => string_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get using uri with query parameter 'green color' - # - # @param enum_query [UriColor] 'green color' enum value. Possible values for - # this parameter include: 'red color', 'green color', 'blue color' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def enum_valid(enum_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/enum/green%20color" - url = URI.join(@client.base_url, path) - properties = { 'enumQuery' => enum_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null (no query parameter in url) - # - # @param enum_query [UriColor] null string value. Possible values for this - # parameter include: 'red color', 'green color', 'blue color' - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def enum_null(enum_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/enum/null" - url = URI.join(@client.base_url, path) - properties = { 'enumQuery' => enum_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array - # - # @param byte_query [Array] '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 - # encoded byte array - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def byte_multi_byte(byte_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/byte/multibyte" - url = URI.join(@client.base_url, path) - properties = { 'byteQuery' => byte_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '' as byte array - # - # @param byte_query [Array] '' as byte array - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def byte_empty(byte_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/byte/empty" - url = URI.join(@client.base_url, path) - properties = { 'byteQuery' => byte_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null as byte array (no query parameters in uri) - # - # @param byte_query [Array] null as byte array (no query parameters - # in uri) - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def byte_null(byte_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/byte/null" - url = URI.join(@client.base_url, path) - properties = { 'byteQuery' => byte_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '2012-01-01' as date - # - # @param date_query [Date] '2012-01-01' as date - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def date_valid(date_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/date/2012-01-01" - url = URI.join(@client.base_url, path) - properties = { 'dateQuery' => date_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null as date - this should result in no query parameters in uri - # - # @param date_query [Date] null as date (no query parameters in uri) - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def date_null(date_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/date/null" - url = URI.join(@client.base_url, path) - properties = { 'dateQuery' => date_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get '2012-01-01T01:01:01Z' as date-time - # - # @param date_time_query [DateTime] '2012-01-01T01:01:01Z' as date-time - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def date_time_valid(date_time_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/datetime/2012-01-01T01%3A01%3A01Z" - url = URI.join(@client.base_url, path) - properties = { 'dateTimeQuery' => date_time_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get null as date-time, should result in no query parameters in uri - # - # @param date_time_query [DateTime] null as date-time (no query parameters) - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def date_time_null(date_time_query = nil, custom_headers = nil) - # Construct URL - path = "/queries/datetime/null" - url = URI.join(@client.base_url, path) - properties = { 'dateTimeQuery' => date_time_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, - # ''] using the csv-array format - # - # @param array_query [Array] an array of string ['ArrayQuery1', - # 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the csv-array format - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def array_string_csv_valid(array_query = nil, custom_headers = nil) - array_query.each{ |e| e.validate if e.respond_to?(:validate) } unless array_query.nil? - # Construct URL - path = "/queries/array/csv/string/valid" - url = URI.join(@client.base_url, path) - properties = { 'arrayQuery' => array_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get a null array of string using the csv-array format - # - # @param array_query [Array] a null array of string using the - # csv-array format - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def array_string_csv_null(array_query = nil, custom_headers = nil) - array_query.each{ |e| e.validate if e.respond_to?(:validate) } unless array_query.nil? - # Construct URL - path = "/queries/array/csv/string/null" - url = URI.join(@client.base_url, path) - properties = { 'arrayQuery' => array_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get an empty array [] of string using the csv-array format - # - # @param array_query [Array] an empty array [] of string using the - # csv-array format - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def array_string_csv_empty(array_query = nil, custom_headers = nil) - array_query.each{ |e| e.validate if e.respond_to?(:validate) } unless array_query.nil? - # Construct URL - path = "/queries/array/csv/string/empty" - url = URI.join(@client.base_url, path) - properties = { 'arrayQuery' => array_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, - # ''] using the ssv-array format - # - # @param array_query [Array] an array of string ['ArrayQuery1', - # 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the ssv-array format - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def array_string_ssv_valid(array_query = nil, custom_headers = nil) - array_query.each{ |e| e.validate if e.respond_to?(:validate) } unless array_query.nil? - # Construct URL - path = "/queries/array/ssv/string/valid" - url = URI.join(@client.base_url, path) - properties = { 'arrayQuery' => array_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, - # ''] using the tsv-array format - # - # @param array_query [Array] an array of string ['ArrayQuery1', - # 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the tsv-array format - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def array_string_tsv_valid(array_query = nil, custom_headers = nil) - array_query.each{ |e| e.validate if e.respond_to?(:validate) } unless array_query.nil? - # Construct URL - path = "/queries/array/tsv/string/valid" - url = URI.join(@client.base_url, path) - properties = { 'arrayQuery' => array_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - # - # Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, - # ''] using the pipes-array format - # - # @param array_query [Array] an array of string ['ArrayQuery1', - # 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the pipes-array format - # @param [Hash{String => String}] The hash of custom headers need to be - # applied to HTTP request. - # - # @return [Concurrent::Promise] Promise object which allows to get HTTP - # response. - # - def array_string_pipes_valid(array_query = nil, custom_headers = nil) - array_query.each{ |e| e.validate if e.respond_to?(:validate) } unless array_query.nil? - # Construct URL - path = "/queries/array/pipes/string/valid" - url = URI.join(@client.base_url, path) - properties = { 'arrayQuery' => array_query } - unless url.query.nil? - url.query.split('&').each do |url_item| - url_items_parts = url_item.split('=') - properties[url_items_parts[0]] = url_items_parts[1] - end - end - properties.reject!{ |key, value| value.nil? } - url.query = properties.map{ |key, value| "#{key}=#{ERB::Util.url_encode(value.to_s)}" }.compact.join('&') - fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/ - corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/') - url = URI.parse(corrected_url) - - connection = Faraday.new(:url => url) do |faraday| - faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02 - faraday.use :cookie_jar - faraday.adapter Faraday.default_adapter - end - request_headers = Hash.new - - unless custom_headers.nil? - custom_headers.each do |key, value| - request_headers[key] = value - end - end - - # Send Request - promise = Concurrent::Promise.new do - connection.get do |request| - request.headers = request_headers - @client.credentials.sign_request(request) unless @client.credentials.nil? - end - end - - promise = promise.then do |http_response| - status_code = http_response.status - response_content = http_response.body - unless (status_code == 200) - error_model = JSON.load(response_content) - fail MsRest::HttpOperationError.new(connection, http_response, error_model) - end - - # Create Result - result = MsRest::HttpOperationResponse.new(connection, http_response) - - result - end - - promise.execute - end - - end -end diff --git a/ClientRuntimes/Python/.gitignore b/ClientRuntimes/Python/.gitignore new file mode 100644 index 000000000..6ab65f878 --- /dev/null +++ b/ClientRuntimes/Python/.gitignore @@ -0,0 +1,72 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +ClientRuntimes/Python/Python35-64-ENV/pip-selfcheck.json +ClientRuntimes/Python/Python35-64-ENV/pyvenv.cfg +ClientRuntimes/Python/Python35-64-ENV/Scripts/activate.bat +ClientRuntimes/Python/Python35-64-ENV/Scripts/Activate.ps1 +ClientRuntimes/Python/Python35-64-ENV/Scripts/deactivate.bat +*.pyc + +#tox directory +*.tox + +#python code coverage +*.coverage +